对lindo.h中声明的函数的未定义引用 [英] undefined reference to functions declared in lindo.h
问题描述
我在这篇文章中也描述了同样的问题:
I have the same problem described in this post:
我正在使用Eclipse编写C/C ++项目.
I am writing a C/C++ project Using Eclipse.
我该如何解决相同的问题?
How can I solve the same problem?
我尝试去:项目->属性-> C ++构建->设置->工具设置-> Gcc c ++库->库->库(-l)
I have tried going to: Project -> properties -> c c++ build -> settings -> Tool Settings->Gcc c++ libraries -> libraries -> libraries (-l)
并在/lindoappi/bin/linux34中添加库.
and adding the libraries in /lindoappi/bin/linux34.
但是它不起作用.我将目录添加到:
but it does not work. I added the directory to:
项目->属性-> c c ++构建->设置->工具设置-> Gcc c ++库->库->库搜索路径
Project -> properties -> c c++ build -> settings -> Tool Settings->Gcc c++ libraries -> libraries -> library search path
控制台输出为:
****为项目LINDO_test创建配置调试****
**** Build of configuration Debug for project LINDO_test ****
全部制作建立目标:LINDO_test调用:GCC C ++链接器g ++ -L/home/mario/lindoapi/bin/linux32 -o"LINDO_test" ./src/LINDO_test.o ./src/test_001.o -lliblindo/usr/bin/ld:找不到-lliblindocollect2:ld返回1退出状态make:*** [LINDO_test]错误1
make all Building target: LINDO_test Invoking: GCC C++ Linker g++ -L/home/mario/lindoapi/bin/linux32 -o"LINDO_test" ./src/LINDO_test.o ./src/test_001.o -lliblindo /usr/bin/ld: cannot find -lliblindo collect2: ld returned 1 exit status make: *** [LINDO_test] Error 1
以下也是相关文章:加载共享库时出错
还有其他建议吗?非常感谢.
Any other suggestions? Thanks a lot.
推荐答案
转到:
项目->属性-> c c ++构建->设置->工具设置-> Gcc c ++链接器->库->库(-l)
Project -> properties -> c c++ build -> settings -> Tool Settings->Gcc c++ linker -> libraries -> libraries (-l)
将库添加为:lindo64mosek64以及您需要的任何东西.
add the libraries as: lindo64 mosek64 and whatever you need.
然后添加:项目->属性-> c c ++构建->设置->工具设置-> Gcc c ++链接器
Then add: Project -> properties -> c c++ build -> settings -> Tool Settings->Gcc c++ linker
确保.../lindoapi/bin/linux64在项目->属性-> c c ++构建->设置->工具设置-> Gcc c ++链接器->库->库搜索路径(-L)
Make sure .../lindoapi/bin/linux64 is in Project -> properties -> c c++ build -> settings -> Tool Settings->Gcc c++ linker -> libraries -> Library search path (-L)
将命令行模式编辑为:$ {COMMAND} $ {OUTPUT} ... -Wl,-rpath =/opt/lindoapi/bin/linux64 $ {INPUTS}
edit the command line pattern to: ${COMMAND} ${OUTPUT} ... -Wl,-rpath=/opt/lindoapi/bin/linux64 ${INPUTS}
由于某些原因,Eclipse仅允许-soname,-out-implib和--output-def对于Wl,因此您必须以这种方式手动进行操作.不干净,但是可以.
for some reason Eclipse only allows -soname, --out-implib, and --output-def for Wl, so you have to do it manually in this way. Is not clean, but it works.
我希望这对其他用户也有用.
I hope this is useful to other users too.
快乐的编码.
这篇关于对lindo.h中声明的函数的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!