Initialization error: cannot find -lgurobi_c++.h
回答済みI have activated my gurobi license (working with Java). I have written a simple model and am trying to run it via C++ in Clion & Windows OS.
I have modified the CMakeList.txt as follows:
cmake_minimum_required(VERSION 3.13)
project(CHEO)
set(CMAKE_CXX_STANDARD 20)
include_directories(C:/gurobi952/win64/include)
add_executable(CHEO main.cpp)
target_link_libraries(CHEO gurobi_c++.h)
However, once I run the model, I face the following error:
[1/1] Linking CXX executable CHEO.exe
FAILED: CHEO.exe
cmd.exe /C "cd . && C:\PROGRA~1\JETBRA~1\CLION2~1.4\bin\mingw\bin\G__~1.EXE -g CMakeFiles/CHEO.dir/main.cpp.obj -o CHEO.exe -Wl,--out-implib,libCHEO.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lgurobi_c++.h -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:\Program Files\JetBrains\CLion 2022.2.4\bin\mingw\bin/ld.exe: cannot find -lgurobi_c++.h
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Please note that I am a beginner (thanks for your patience in advance!)
0
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Maybe How do I use CMake to build Gurobi C/C++ projects? might be helpful.
0 -
To explain the error: You cannot specify header files (*.h) in the CMake command target_link_libraries. This command is meant to specify libraries like libgurobi.so.
0
投稿コメントは受け付けていません。
コメント
3件のコメント