无法使用静态库编译c ++库

时间:2013-09-03 20:38:28

标签: c++ c linux static-libraries

我下载了一个我想用于模拟的C ++库。

它包括: 1-源文件“main.cpp” “Include”文件夹中的2-头文件 3-静态预编译库“libhj.a” 4- Cmakelist.txt

在他们的手册中,他们建议使用GNU& Cmake编译并生成可执行文件。

我没有希望尝试了几种解决方案! 1-我在Windows 7上下载了MinGW和Cmake,并尝试使用它们首先生成Makefile,然后使用“make”命令生成exe文件,但无法正常工作。 2-所以我切换到linux“Ubuntu”,这就是我得到的:

`enter code here`CMakeFiles/exe.dir/src/main.cpp.o: In function `main':
main.cpp:(.text.startup+0x2d1): undefined reference to `HJB_SL::HJB_SL(mrp, cp, cp, pp, gp, ppp, slp)'
main.cpp:(.text.startup+0x2d9): undefined reference to `HJB::initFiles() const'
main.cpp:(.text.startup+0x2ea): undefined reference to `HJB::postprocess()'
main.cpp:(.text.startup+0x49c): undefined reference to `HJB_FD::HJB_FD(mrp, cp, cp, pp, gp, ppp, fdp)'
collect2: ld returned 1 exit status
make[2]: *** [exe] Error 1
make[1]: *** [CMakeFiles/exe.dir/all] Error 2
make: *** [all] Error 2`

任何人都可以指导我做什么吗? 感谢。

0 个答案:

没有答案