Compiling igraph projects in Visual Studio 2013
Download
Currently, I am testing igraph-0.7.1-msvc. http://igraph.org/c/#downloads
Compile the igraph library
- Open the igraph.sln solution file in igraph-0.7.1-msvc from Visual Studio 2013. Let the Visual Studio convert the solution file for you.
- Add a compiler option (for both Debug and Release): Open Project menu -> Properties -> C/C++ -> Command Line. In Additional options, add the following option: “/DPRPACK_IGRAPH_SUPPORT=1” (without the quotes)
- Debug -> Build and Release -> Build
Compile igraphtest
- Adding a path to the directory containing ‘igraph.lib’ (for both Debug and Release). Open Project -> Properties -> VC++ Directory -> Library Directory -> Edit. Add new path which points to the Debug/Release directory in your igraph directory (igraph-0.7.1-msvc folder/Debug, for example).
- Open Project -> Properties -> VC++ Directory -> Include Directory -> Edit. Add new path which points to the include directory in your igraph-0.7.1-msvc folder.
- Make sure “Project -> Properties -> Linker -> General -> Additional Library Directories” points to your igraph Debug/Release directory.
- Make sure the setting of “Project -> Properties -> C/C++ -> Code Generation -> Runtime Library” in the Debug mode (resp. Release mode) matches the setting in the Debug (resp. Release mode) mode of the igraph project.
Compile other projects
Error: “error LNK2001: unresolved external symbol “public: __thiscall prpack….”. Fix:
- Make a new folder “prpack” in your <your_project_src> folder.
- Copy igraph-0.7.1-msvc folder/prpack/prpack_* to <your_project_src>/prpack folder.
- In Visual Studio 2013, Add prpack_* to your “Header Files” and “Source Files”
- Add a compiler option (for both Debug and Release): Open Project menu -> Properties -> C/C++ -> Command Line. In Additional options, add the following option: “/DPRPACK_IGRAPH_SUPPORT=1” (without the quotes)
- Edit your prpack_solver.cpp, add “#include <algorithm>#, otherwise you may see a compile error.
Error during debugging: “Run time Check failure #3: * is being used without being initialized”. I saw this error when I run the “example/eigenvector_centrality.c” provided by igraph. Because I do not want to modify their codes, here goes my fix (yes, I know turn this off is not a good idea):
- While compiling igraph and your project, set “Open Project -> Properties -> C/C++ -> Code Generation -> Basic Runtime Checks” as “Default”.
The above steps help me compile my first igraph project successfully finally. I will keep updating this list if I see more errors…