I am writing a c++ program from the windows cmd prompt, and compiling with mingw (g++
). This program needs a non-linear optimiser and NLOpt looks like a good choice. I learnt c++ for a uni course, so the environment I was using was already set up, I have no experience in setting up libraries etc.
So far my steps have been;
Download the precompiled DLLs for 64-bit windows (which is what I'm running) from here.
Run the command
dlltool --input-def libnlopt-0.def --dllname libnlopt-0.dll --output-lib libnlopt-0.lib
(from the same page), which ran without errors.
This creates an .hpp file, however, when I try to #include
the file I get
In file included from optimiseDogs.cc:9:0:
C:\Files|Development\NLOpt2.4.2\nlopt.hpp:29:19: fatal error: nlopt.h: Nosuch file or directory
#include <nlopt.h>
nlopt.h
and nlopt.hpp
are in the same directory as each other. My program is in a different folder.
This is probably really basic, sorry to trouble you with it. Perhaps I am not completely alone in my ignorance and this will help someone else too. Also, I have seen this question, but it deals with installing on visual basic, and I'm not using a GUI, just notepad++ and the cmd prompt.
Thank you for your help.
If you are in
windows
and usingmingw
: downloaded zip archive already contains.dll
and.lib
files. So you dont need to rundlltool
which creates these.lib
,.dll
from.def
. I think your problem is compiling command usingg++
adding include and library path directives.I encounted in the past that order of
-I
and-L
may matter so try changing if not working. Please see this tut and that tut to understand the concept.