Skip to main content

Error when compiling mip1_c++ using VSCode on mac

Ongoing

Comments

6 comments

  • Yingqiu Zhang
    Gurobi-versary
    First Question
    Conversationalist

    By the way, I can successfully build all examples in /Library/gurobi901/mac64/examples/build using the makefile.

    0
  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    Hi,

    You need to change "-l /Library/gurobi901/mac64/include" to "-I/Library/gurobi901/mac64/include". That's a capital "I" - to specify the include directory. The library is already loaded using "-L" and "-l".

    I would not call the binary EXE, by the way. This is usually only done on Windows.

    You might also want to check out CMake for easier compilation/building.

    Cheers,
    Matthias

    0
  • Yingqiu Zhang
    Gurobi-versary
    First Question
    Conversationalist

    Hi,

    Thanks! It is my typo.

    The link in your post is very useful! Thanks for sharing! My next step is to learn how to use CMake to build c++ project. I tried to use the template of CMakeLists from the link, but I have following errors: 

    CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

    Please set them or make sure they are set and tested correctly in the CMake files:

    GUROBI_CXX_LIBRARY

        linked by target "gurobi-template" in directory /Users/yingqiuzhang/Documents/TestVSC/helloworld

        linked by target "gurobi-template" in directory /Users/yingqiuzhang/Documents/TestVSC/helloworld

    GUROBI_INCLUDE_DIRS

       used as include directory in directory /Users/yingqiuzhang/Documents/TestVSC/helloworld

       used as include directory in directory /Users/yingqiuzhang/Documents/TestVSC/helloworld

       used as include directory in directory /Users/yingqiuzhang/Documents/TestVSC/helloworld

     

    -- Configuring incomplete, errors occurred!

    See also "/Users/yingqiuzhang/Documents/TestVSC/helloworld/build/CMakeFiles/CMakeOutput.log".

     

    I am new to this. I appreciate your help!

     

     

     

    0
  • Yingqiu Zhang
    Gurobi-versary
    First Question
    Conversationalist

    I solved above issues by adding GRUOBI_HOME environment variable. 

    0
  • Jacob Jin
    Gurobi-versary
    Curious
    Collaborator

    Hi, I have encounter the same issues even thought I add the GRUOBI_HOME environment variable.  

    set(GUROBI_HOME "/Library/gurobi912/mac64")

    And that's my errors:

     

     

    The tsp is my file name, I don't know what should I do to fix the error, thank u so much!!

     

     

    1
  • Peter Dieter
    Gurobi-versary
    First Comment

    Jacob Jin
    I have the same issue. Did you manage to fix it?

    0

Please sign in to leave a comment.