0

Some back story: I am trying to get the bolt-lmm software to compile on a Windows machine, because it would be a nice addition to the research group I am in. The developers of the software have only made a linux static executeable, but made the source code available. I am used to programming in R or python, and this is my first ever encounter with C++.

I have solved a fair bit of problems, but for some reason I have not been able to get visual studio to link properly with Nlopt-2.4.2.

I downloaded it and followed the steps given there on how to install it.

I can tell I have done the same to link the Nlopt library to the project as is described in How to add additional libraries to Visual Studio project?

I still get errors like:

Error   LNK2019 unresolved external symbol __imp__nlopt_create referenced in function "public: __thiscall nlopt::opt::opt(enum nlopt::algorithm,unsigned int)" (??0opt@nlopt@@QAE@W4algorithm@1@I@Z)    boltCompiler    C:\Users\au483192\source\repos\boltCompiled\boltCompiler\NonlinearOptMulti.obj  1   

(there are a total of 12 of this type of error, and an error link 1120, which just tells me there are 12 unresolved eternals.)

I hope this is enough information to provide a hint of what is going wrong.

Carlos Cavero
  • 3,011
  • 5
  • 21
  • 41
Fmylife92
  • 121
  • 6

1 Answers1

1

I did some more digging, and it seems the linker needed more than just the folder for the .lib file.

This post sums it up: Linking a static library to my project on Visual Studio 2010

Essentially you just need to tell the linker the placement of the lib and the actual name of the .lib file.

Hopefully this will help others who forgot/did not know that added library names manually could be needed for some libraries.

TL;DR: open configuration properties for the project > linker > general Then add the path to the .lib file in the "addition library directories" line

Then (still in configuration properties) go to linker > input add the .lib file name to the "addition dependencies" line, e.g. libnlopt-0.lib (don't forget to separate with ";")

Fmylife92
  • 121
  • 6