Problem with using Gurobi in Netbeans

333 views
Skip to first unread message

王志航

unread,
Aug 29, 2014, 2:59:15 AM8/29/14
to gur...@googlegroups.com
Hello, I'm a stater to use Gurobi in windows. My development environment is Netbeans. I try to copy the code of mip1_c.c, and also the header file gurobi_c.h. But, after building the project, there are some error messages which are shown below. Can anybody tell me how can I fix it? Thanks

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/d/Codes/GurobiTest'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/gurobitest.exe
make[2]: Entering directory '/cygdrive/d/Codes/GurobiTest'
mkdir -p dist/Debug/Cygwin_4.x-Windows
gcc     -o dist/Debug/Cygwin_4.x-Windows/gurobitest build/Debug/Cygwin_4.x-Windows/main.o 
build/Debug/Cygwin_4.x-Windows/main.o: In function `main':
/cygdrive/d/Codes/GurobiTest/main.c:32: undefined reference to `GRBloadenv'
/cygdrive/d/Codes/GurobiTest/main.c:32:(.text+0x51): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBloadenv'
/cygdrive/d/Codes/GurobiTest/main.c:37: undefined reference to `GRBnewmodel'
/cygdrive/d/Codes/GurobiTest/main.c:37:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBnewmodel'
/cygdrive/d/Codes/GurobiTest/main.c:45: undefined reference to `GRBaddvars'
/cygdrive/d/Codes/GurobiTest/main.c:45:(.text+0x157): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBaddvars'
/cygdrive/d/Codes/GurobiTest/main.c:51: undefined reference to `GRBsetintattr'
/cygdrive/d/Codes/GurobiTest/main.c:51:(.text+0x184): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBsetintattr'
/cygdrive/d/Codes/GurobiTest/main.c:56: undefined reference to `GRBupdatemodel'
/cygdrive/d/Codes/GurobiTest/main.c:56:(.text+0x1a4): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBupdatemodel'
/cygdrive/d/Codes/GurobiTest/main.c:65: undefined reference to `GRBaddconstr'
/cygdrive/d/Codes/GurobiTest/main.c:65:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBaddconstr'
/cygdrive/d/Codes/GurobiTest/main.c:73: undefined reference to `GRBaddconstr'
/cygdrive/d/Codes/GurobiTest/main.c:73:(.text+0x2b3): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBaddconstr'
/cygdrive/d/Codes/GurobiTest/main.c:78: undefined reference to `GRBoptimize'
/cygdrive/d/Codes/GurobiTest/main.c:78:(.text+0x2d3): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBoptimize'
/cygdrive/d/Codes/GurobiTest/main.c:83: undefined reference to `GRBwrite'
/cygdrive/d/Codes/GurobiTest/main.c:83:(.text+0x2fa): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBwrite'
/cygdrive/d/Codes/GurobiTest/main.c:88: undefined reference to `GRBgetintattr'
/cygdrive/d/Codes/GurobiTest/main.c:88:(.text+0x328): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GRBgetintattr'
/cygdrive/d/Codes/GurobiTest/main.c:91: undefined reference to `GRBgetdblattr'
/cygdrive/d/Codes/GurobiTest/main.c:91:(.text+0x356): additional relocation overflows omitted from the output
/cygdrive/d/Codes/GurobiTest/main.c:94: undefined reference to `GRBgetdblattrarray'
/cygdrive/d/Codes/GurobiTest/main.c:113: undefined reference to `GRBgeterrormsg'
/cygdrive/d/Codes/GurobiTest/main.c:119: undefined reference to `GRBfreemodel'
/cygdrive/d/Codes/GurobiTest/main.c:123: undefined reference to `GRBfreeenv'
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:62: recipe for target 'dist/Debug/Cygwin_4.x-Windows/gurobitest.exe' failed
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/gurobitest.exe] Error 1
make[2]: Leaving directory '/cygdrive/d/Codes/GurobiTest'
nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/d/Codes/GurobiTest'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2


BUILD FAILED (exit value 2, total time: 853ms)

T.

unread,
Aug 29, 2014, 8:00:39 AM8/29/14
to gur...@googlegroups.com
Are you using a 64-bit version of Gurobi and a 64-bit C-Compiler (e.g. this one)?

王志航

unread,
Aug 31, 2014, 10:33:19 PM8/31/14
to gur...@googlegroups.com
Yes

T.於 2014年8月29日星期五UTC+8下午8時00分39秒寫道:

王志航

unread,
Sep 1, 2014, 3:37:34 AM9/1/14
to gur...@googlegroups.com
I use cygwin64 and netbeans IDE7.4. I think its the problem of path setting or including, but i have not had any idea to solve it.

王志航於 2014年9月1日星期一UTC+8上午10時33分19秒寫道:

T.

unread,
Sep 2, 2014, 10:12:58 AM9/2/14
to gur...@googlegroups.com
These are linker errors, not compiler errors. So the include paths should not be the problem.

I never used Cygwin64. So I don't know whether this is compatible. I can only tell you that it works with the MinGW-Verison I posted above.

Fabio Morais

unread,
Jun 7, 2017, 12:24:47 AM6/7/17
to Gurobi Optimization
hello,

i am facing the same problem,

did you realize how to solve it?

thanks
Fabio

José Eurique C. Ribeiro Junior

unread,
Mar 12, 2018, 7:04:53 AM3/12/18
to Gurobi Optimization
Hey dude,
 
i am facing the same problem, did you realize how to solve it? (haha)
 
Thanks
Eurique
Reply all
Reply to author
Forward
0 new messages