Question

I just started C recently and have been writing some basic C code, but is a bit clueless about how I should go about "installing" libraries like igraph in Visual Studio 2010. I downloaded the igraph "source code for Microsoft Visual Studio" here: http://igraph.sourceforge.net/download.html

(naive) Attempt

There is an "include" folder with all the ".h" files that I copied to the directory that my Visual Studio is set up to look in whenever I use include < something.h > but I get a "unresolved external symbol", which I know means the library isn't set up correctly.

Question

How should I go about "installing" igraph? (and possibly other C libraries)

Was it helpful?

Solution 2

Mark's answer was very helpful, but there were other issues. Following these step resolved it for me. Hopefully this will help someone in the future.

Step 1

The igraph package is a bunch of ".c" and ".h" files that was missing the ".lib" file in Mark's answer. It has to be open and build in Visual Studio. Then, the ".lib" file will appear in the "Debug" folder.

Step 2

Do the steps in Mark's answer.

However, in "VC++ Directories" there is a line call "Include Directories" where you have to store the path to your igraph include directory. This is so that Visual Studio can find the correct files when you write e.g. #include <include/igraph.h>.

Step 3

If you get a "...already defined in MSVCRTD.lib..." error. Then, visit this answer: How to resolve the following linker errors in Visual Studio?

Each of the libraries/subprojects that you are using must be compiled with the same option in "C/C++ -> Code Generation -> Runtime library".

OTHER TIPS

Look in to the folders of your library, I suppose, you'll find a .lib file there.

Go to your project settings and open the linker settings. Under Input you should find additional dependencies. Add your .lib file(s) there. You also might need to add the folder where this .lib file(s) reside to the library folders (found under VC++-folders).

I have the german version of MSVC here, so your menu entries might be named slightly different, but you will find them ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top