0

I am using GUROBI Optimizer in my C++ code to solve a mathematical optimization problem.

I include the header "gurobi_c++.h", and to be able to use this I do:

  1. Configuration properties -> C/C++ -> General -> Additional Include directories: I add directory of Gurobi
  2. Configuration properties -> Linker -> General -> Additional Library dependencies: I add library directory of Gurobi
  3. Configuration properties -> Linker -> Input -> Additional dependencies: I add Gurobi's relevant .lib files

And, under the 'debug' mode, everything runs perfectly. However, 'release' mode gives a lot of 'LNK2001' errors. Each error looks like:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2001 unresolved external symbol __imp__invalid_parameter project_name    ...\gurobi_c++mdd2019.lib(Callback.2019.omdd)   1   

I don't know why only 'Release' mode has this issue. I compared the settings between 'Debug' and 'Release' modes, there is no difference!

However, maybe the reason is related to this: In Configuration Properties -> Debugging -> Environment, I add to the environment path as:

PATH=$(PATH);$...\gurobi900\win64\lib

So maybe it is because I don't have such an environment in release? I don't know how to fix this.

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • 1
    Compare the project properties of release and debug mode. I'm sure you added some libraries only for the "Debug" configuration. When you add libraries (and most other settings), add them for the "All Configurations" configuration. – Jabberwocky Feb 12 '20 at 13:31
  • 1
    @Jabberwocky Actually no, I set all the options from 'all configurations'. That's the odd thing here which I can't understand why – independentvariable Feb 12 '20 at 14:09
  • `_invalid_parameter()` is a C runtime function, not a Gurobi function. Intentionally not linking the .lib file that defines it is quite hard to do, you'd have to use the /nodefaultlib linker option. Never do that. – Hans Passant Feb 12 '20 at 16:08

0 Answers0