C++ - issue while porting C++ code from Visual Studio to Linux Eclipse IDE -
i have project build in microsoft visual studio , want port in linux(opensuse 12.2) using eclipse ide.
the project using opencv , have managed build opencv in linux. not huge, contains 3 .cpp files , 4 .h files defines classes used in project , 1 of .cpp files contains main() function.
however, there 1 additional instances.inc file following content:
#include "graph.h" #ifdef _msc_ver #pragma warning(disable: 4661) #endif // instantiations: <captype, tcaptype, flowtype> // important: // flowtype should 'larger' tcaptype // tcaptype should 'larger' captype template class graph<int,int,int>; template class graph<short,int,int>; template class graph<float,float,float>; template class graph<double,double,double>; where graph.h contains declaration of graph class.
i changed extension of instances.inc file instances.h file. however, when try build project receive following error:
../src/branchandmincut.cpp:246: undefined reference `graph<int, int, int>::maxflow(bool, block<int>*)' which guess related .inc file. know how solve problem?
edit:
i want mention instanes.inc files included @ end of graph.cpp file.
you using instantiating of template classes. first thing may delete .cpp-file contains realization of template class graph , put implementation of methods , etc in graph.h file - action make instantiating unnecessary. next thing can try rename instances.h/inc instances.cpp , compile (place in makefile or use).
i've found links:
http://www.cplusplus.com/forum/articles/10627/
Comments
Post a Comment