Undefined Reference Error
OngoingHello. I am trying to compile the sample project mip1c++ with the mingw-w64 compiler. The console command I used to compile is:
g++ mip1.cpp -o mip1 -I C:\gurobi1100\win64\include -L C:\gurobi1100\win64\lib -lgurobi_c++ -l:libgurobi_c++.a
I compiled the libgurobic++.a library file as indicated here: https://support.gurobi.com/hc/en-us/articles/360039093112-How-do-I-resolve-undefined-reference-errors-while-linking-Gurobi-in-C- and copied it to gurobi1100/linux64/lib directory, but it still gives "undefined reference" error. By the way, I'm using Win11, but do I need to compile Gurobi for Win64? I upload a screenshot of my output.

-
Official comment
This post is more than two 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. -
Hi,
You may have to edit the \(\texttt{Makefile}\) in the installation \(\texttt{src/build/}\) directory to compile using the same compiler that you are using here.
The instructions in the Makefile for Windows include compiling using Visual Studio, which you do not need.
Cheers,
David0 -
Hi.
I believe that I am using same compiler for both processes. You can see my compiler details below.
PS C:\gurobi1100\linux64\src\build> g++ -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=nocona --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Rev2, Built by MSYS2 project)
PS C:\gurobi1100\linux64\src\build>0
Post is closed for comments.
Comments
3 comments