Search code examples
cygwinmingwigraph

Various issues installing igraph in Visual Studio 2010 and Cygwin/MinGW ("sys/time.h not found")


I couldn't get igraph to work with Visual Studio 2010 (supposedly many known issues), and so decided to try installing it in Cygwin. ./configure went fine. But make gave this error:

f2c/dtime_.c:16:23: fatal error: sys/times.h: No such file or directory

Makefile:2190: recipe for target `libf2c_la-dtime_.lo' failed
make[3]: *** [libf2c_la-dtime_.lo] Error 1

I tried installing it in MinGW and get the same error when I make. Should I be providing "sys/time.h" or a path to it? Where is sys/time.h? Using Windows 7.

Edit

The problems in Cygwin and MinGW was due to the wrong version of gcc being used by my clean installation of Cygwin (and a characteristic of MinGW). Solution here: Installing/compiling in Cygwin/MinGW - How to set the include "path"? (symbolic link?)

The problem in Visual Studio 2010 was due to building in "Debug" instead of "Release". One of igraph's creator, Gábor Csárdi, graciously provided an excellent step-by-step guide below that identified and resolved it.


Solution

  • Igraph actually does work with Visual C++ 2010 Express, we test this before releases, and I have just tried it. You need to do the following steps.

    1. Download the source package specifically created for Visual Studio.
    2. Uncompress the file into My Documents\Visual Studio 2010\Projects.
    3. Open the igraph.sln solution file in igraph-0.6-msvc\igraph-0.6-msvc directory from Visual Studio.
    4. Visual Studio offers to convert the solution file to the current format, do that. Just click on Next, Next and Finish.
    5. On the toolbar, change 'Debug' to 'Release' to make release builds.
    6. Choose Debug -> Build solution and wait until the library is built.

    To test it you can open the solution file in the igraphtest directory, convert it as well, choose 'Release' builds, and then build it and run it from the command line. It is a simple C++ program that uses igraph to create a graph and write it into the file out.txt.

    You don't have to set up include and library directories at all, everything is set up properly in the solution file, both for igraph and igraphtest.