【发布时间】:2014-03-21 10:31:46
【问题描述】:
我有一个在 Microsoft Visual Studio 中构建的项目,我想使用 Eclipse IDE 将它移植到 Linux(OpenSuse 12.2) 中。
该项目正在使用 OpenCV,我已设法在 Linux 中构建 OpenCV。它不是那么大,它包含 3 个 .cpp 文件和 4 个 .h 文件,它们实际上定义了项目中使用的类,其中一个 .cpp 文件包含main() 函数。
但是,还有一个额外的instances.inc 文件,其内容如下:
#include "graph.h"
#ifdef _MSC_VER
#pragma warning(disable: 4661)
#endif
// Instantiations: <captype, tcaptype, flowtype>
// IMPORTANT:
// flowtype should be 'larger' than tcaptype
// tcaptype should be 'larger' than 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>;
其中graph.h 包含Graph 类的声明。
我将instances.inc 文件的扩展名更改为instances.h 文件。但是,当我尝试构建项目时,我收到以下错误:
../src/BranchAndMincut.cpp:246: undefined reference to `Graph<int, int, int>::maxflow(bool, Block<int>*)'
我猜它与.inc 文件有关。你知道如何解决这个问题吗?
编辑:
我还想提一下instanes.inc 文件包含在graph.cpp 文件的末尾。
【问题讨论】:
标签: c++ linux eclipse visual-studio