igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] igraph 0.6 visual studio 2008 (vc9 sp1) bugfixes


From: Laurence Muller
Subject: [igraph] igraph 0.6 visual studio 2008 (vc9 sp1) bugfixes
Date: Wed, 19 May 2010 12:10:57 -0700 (PDT)
User-agent: G2/1.0

Hi Gabor & Tamas!

I'm still using igraph for my projects and recently tried igraph 0.6
from the repository.
Unfortunately it didn't want to build out of the box so I've made a
list of required changes that hopefully help you and others to make it
work in Visual Studio 2008 (VC9 SP1).

Here is what I did:



(1)
On my linux box (ubuntu 10.04 x64) I did a new checkout:
# bzr branch lp:igraph/0.5-main


(2)
This was revision r1929.
Next I used the following commands:
# ./bootstrap.sh
# ./configure
# make msvc

After a while this will produce an igraph-0.6-msvc.zip file.


(3)
- Copy this file to the windows machine.
- Also copy the 'include' dir from the igraph directory to your
windows machine (shouldn't this be included in the zip!?)

On you windows machine you should now have something like this:
C:\xxx\Development\igraph-0.6-msvc\igraph-0.6-msvc
C:\xxx\Development\igraph-0.6-msvc\igraphtest
C:\xxx\Development\igraph-0.6-msvc\include


(4)
Open igraph.sln from this directory:
C:\xxx\Development\igraph-0.6-msvc\igraph-0.6-msvc

If required, just hit the finish button to convert the project to the
latest version of visual studio.


(5) patching
Before you can compile the project (in release mode) you will need to
patch a bunch of files.

(5.1) - igraph.vcproj
First, we need to add the missing include dir.
- ALT-F7 to open the project properties (or rightmouse click on the
igraph project in the left sidebar)
- Go to "Configuration Properties > C/C++ > General \ Additional
Include Directories".
- Change $(ProjectDir)src;$(ProjectDir)winclude to $(ProjectDir)src;$
(ProjectDir)winclude;..\include
- Click Apply and OK

(Do it for Release and Debug configurations)

(5.2) - drl_graph.cpp (error C2668: 'sqrt' : ambiguous call to
overloaded function)
change line 1145:
  float num_connections = sqrt(neighbors[node_ind].size());
to
  float num_connections = sqrt((double)neighbors[node_ind].size());

(5.3) - community.c (error C2143: syntax error : missing ';' before
'type')
Since this is a *.c file, visual studio treats the file differently
than a *.cpp file. If it is a C file, you will need to put the
variable declarations at the top of a function.

so at line: 2030:
        igraph_vector_t edges;

  /* Make sure there's enough space in eids to store the new edge IDs
*/
  IGRAPH_CHECK(igraph_vector_resize(eids, ecount));

  igraph_i_multilevel_link *links = igraph_Calloc(ecount,
igraph_i_multilevel_link);

change to:

  igraph_vector_t edges;
  igraph_i_multilevel_link *links;

  /* Make sure there's enough space in eids to store the new edge IDs
*/
  IGRAPH_CHECK(igraph_vector_resize(eids, ecount));

  links = igraph_Calloc(ecount, igraph_i_multilevel_link);

(5.4) - community.c (error C2054: expected '(' to follow 'inline')
'inline' does not work in *.c files when using visual studio, so
either change the extension to *.cpp or remove the 'inline' keyword.
at line 2179:
  inline igraph_real_t igraph_i_multilevel_community_modularity_gain(
to
  // inline
  igraph_real_t igraph_i_multilevel_community_modularity_gain(

(5.5) - community.c (error C2143: syntax error : missing ';' before
'type')
at line 2349, in function:
  int igraph_i_community_multilevel_step(igraph_t *graph,
igraph_vector_t *weights, igraph_vector_t *membership, igraph_real_t
*modularity)

put these declaration at the top (and ofcourse rewrite the ones that
are already in the function):
  long int old_id;      (on line 2349)
  long int new_id;  (on line 2350)
  igraph_real_t max_q_gain;     (on line 2362)
  igraph_integer_t max_weight;  (on line 2363)
  long int n;                   (on line 2364)


(5.6) - cliques.c (error C2275: 'igraph_vector_t' : illegal use of
this type as an expression)
at line 753:
  igraph_vector_t* vec = igraph_Calloc(1, igraph_vector_t);
change it to:
  vec = igraph_Calloc(1, igraph_vector_t);
and move the declaration to the top:
  igraph_vector_t* vec;


(6) - Build
Set the project to Release or Debug mode and press F7 to build.
the result (igraph.lib) will be build in C:\xxx\Development\igraph-0.6-
msvc\igraph-0.6-msvc\Release





(7) Fixing igraphtest
Add the missing include dir.
- ALT-F7 to open the project properties (or rightmouse click on the
igraph project in the left sidebar)
- Go to "Configuration Properties > C/C++ > General \ Additional
Include Directories".
- Change "..\igraph-0.5.2-msvc\src" to ..\include
- Click Apply
- Go to "Configuration Properties > Linker > General \ Additional
Library Directories".
- Change "..\igraph-0.5.2-msvc\Release" to "..\igraph-0.6-msvc
\Release" (or "..\igraph-0.6-msvc\Debug"
- Click Apply and OK

(8) - Building..
When trying to build you will end up with these errors:

1>igraph.lib(foreign.obj) : error LNK2019: unresolved external symbol
_igraph_dl_yyparse referenced in function _igraph_read_graph_dl
1>igraph.lib(foreign.obj) : error LNK2019: unresolved external symbol
_igraph_i_dl_mode referenced in function _igraph_read_graph_dl
1>igraph.lib(foreign.obj) : error LNK2019: unresolved external symbol
_igraph_dl_yyin referenced in function _igraph_read_graph_dl
1>Release/igraphtest.exe : fatal error LNK1120: 3 unresolved externals

Which are related to this file: foreign.c

The problem is that these functions are defined but not implemented?
extern int igraph_dl_yyparse(void);
extern FILE *igraph_dl_yyin;
extern int igraph_i_dl_mode;


Would you know how to fix this problem?

Thanks,
- Laurence




reply via email to

[Prev in Thread] Current Thread [Next in Thread]