简体   繁体   English

在Linux上的Eclipse C ++中设置CPLEX

[英]Setting Up CPLEX in Eclipse C++ on Linux

I have installed CPLEX 12.6.3 (CPLEX_Studio_Community1263) and I want to integrate CPLEX in my Eclipse C++ project (on Linux). 我已经安装了CPLEX 12.6.3(CPLEX_Studio_Community1263),并且想将CPLEX集成到我的Eclipse C ++项目中(在Linux上)。 But I don't know which steps I have to follow to include CPLEX in my project. 但是我不知道将CPLEX包含在我的项目中必须遵循哪些步骤。

Even by following exactly the steps shown at this link , it still not working for me (I can't import cpelx.jar in my project). 即使完全按照此链接中显示的步骤进行操作 ,它仍然对我不起作用(我无法在项目中导入cpelx.jar )。 The path of my cplex.jar is 我的cplex.jar的路径是

/opt/ibm/ILOG/CPLEX_Studio_Community1263/cplex/lib/cpelx.jar

When I right-click on my project and go to 当我右键单击我的项目并转到

Properties --> Settings --> GCC C++ Linker --> Libraries

to add the cplex.jar in my project, it is impossible to add the .jar because I can't select it (it is deselected and impossible to select it). 要将cplex.jar添加到我的项目中,将无法添加.jar,因为我无法选择它(取消选择并且无法选择它)。

Can some one explain me how I can include CPLEX in my project? 有人可以解释一下如何在我的项目中包括CPLEX吗?

The link you reference is for setting up a Java program. 您引用的链接用于设置Java程序。 This will not help you. 这对您没有帮助。

Instead, you should try running one of the C++ examples shipped with CPLEX. 相反,您应该尝试运行CPLEX附带的C ++示例之一。 Try the following (assuming your path is correct from above): 请尝试以下操作(假设您的路径从上方是正确的):

$ cd /opt/ibm/ILOG/CPLEX_Studio_Community1263/cplex/examples/x86-64_linux/static_pic
$ make ilolpex1 2>&1 | tee output.txt

This will save the output in output.txt so that you can look at it later. 这会将输出保存在output.txt以便您以后查看。 It should give you an idea of what the required command line arguments are. 它应该使您了解所需的命令行参数是什么。

For example, on my system (x86-64_linux), I see this in the output: 例如,在我的系统(x86-64_linux)上,我在输出中看到了这一点:

$ make ilolpex1
g++ -O0 -c -m64 -O -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include  ../../../examples/src/cpp/ilolpex1.cpp -o ilolpex1.o
g++ -O0 -m64 -O -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include  -L../../../lib/x86-64_linux/static_pic -L../../../../concert/lib/x86-64_linux/static_pic -o ilolpex1 ilolpex1.o -lconcert -lilocplex -lcplex -lm -lpthread

This tells you everything you need to know to compile and link your program. 这将告诉您编译和链接程序所需的所有知识。 You'll just need to figure out where to enter this information in Eclipse. 您只需要弄清楚在Eclipse中何处输入此信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM