igraph 0.5.x visual studio 2005 ‘fix’

Authors: Gábor Csárdi and Tamás Nepusz

Official site: http://cneurocvs.rmki.kfki.hu/igraph/index.html
Repository: http://bazaar.launchpad.net/~igraph/igraph

Notes on the mailing list: http://lists.nongnu.org/archive/html/igraph-help/2009-07/msg00013.html

downloads

note: these are unofficial and unsupported builds!
05-main-rev1294-vs8
Full source code (this is rev1294 with my fixes for visual studio 2005)
05-main-rev1294-vs8 binary include files and library only, use this if you just want to use igraph in visual studio 2005
05-main-rev1294-vs8 example Example project, requires the ‘binary’ package

Know issues

  • File reader/writers aren’t working (GML/Graphml/Pajek/Graphviz etc)

List of changes

Using revision 1294
Repository: https://code.launchpad.net/~igraph/igraph/0.5-main

1. bliss_timer.cc line 18, Remove or make the following line a comment:

#include <unistd.h>

2. Add #ifndef YY_NO_UNISTD_H at the top of the following files:

  • foreign-gml-lexer.c
  • foreign-lgl-lexer.c
  • foreign-ncol-lexer.c
  • foreign-pajek-lexer.c

After these ‘fixes’ the library will build (igraph.lib) but not work yet.
When trying the examples from:
http://cneurocvs.rmki.kfki.hu/igraph/doc/html/ch03s01.html
http://cneurocvs.rmki.kfki.hu/igraph/doc/html/ch03s03.html

3. Fix the missing _ifinite issue:
Add in random.c:

#include <float.h>

4. Fix the missing isnan issue (also in random.c, _isnan requires float.h):

int R_isnancpp(double x)
{
return (_isnan(x)!=0);
// return (isnan(x)!=0);
}

and

#ifdef __cplusplus
int R_isnancpp(double); /* in arithmetic.c */
#define ISNAN(x) R_isnancpp(x)
#else
//#define ISNAN(x) (isnan(x)!=0)
#define ISNAN(x) (_isnan(x)!=0)
#endif

5. Fix the missing round issue (also in random.c):
Add this line near the includes at the top:

int round (double x)
{
  int i = (int) x;
 
  if (x >= 0.0)
  {
    return ((x-i) >= 0.5) ? (i + 1) : (i);
  }
  else
  {
    return (-x+i >= 0.5) ? (i - 1) : (i);
  }
}

6. Fix the missing isnan issue (in math.c)
change line 44:

return (!isnan(x) & (x != IGRAPH_POSINFINITY) & (x != IGRAPH_NEGINFINITY));

to

return (!_isnan(x) & (x != IGRAPH_POSINFINITY) & (x != IGRAPH_NEGINFINITY));

7. igraph.lib(structure_generators.obj):

error LNK2019: unresolved external symbol _strcasecmp referenced in function _igraph_famous

solution
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/cf092a87-3256-4d02-81c6-57c707e71e13/

add this at the top of the file:

#if defined(WIN32) || defined(WIN64)
#define strcasecmp _stricmp
#endif /* Def WIN32 or Def WIN64 */

3 Comment

    Mathias

    Hello Laurence,

    thank you for providing the Visual Studio Project files. Regarding the file read/write problems: Is it a bug in iGraph or some problem with the Windows build?

    Thanks,
    Mathias

    13 May 2010 | Reply

  1. Mathias

    Hello again,

    in the meanwhile I compiled a new version with file read/write support and the latest igraph source (0.5.3).
    Thank you again for the explanation. Without it I wouldn’t be able to build it.

    /Mathias

    14 May 2010 | Reply

  2. Actually I don’t know what is causing the read and write problems. It’s probably related to the compiler…

    All these fixes van been reported to Gabor and Tamas, so I think future version might not require these patch instructions.

    14 May 2010 | Reply

    Leave a reply