Using casadi from C (Windows, MinGW)

jgillis edited this page Feb 24, 2016 · 2 revisions

From @damienpicard:

  1. Download casadi-matlabR2014b-v2.4.2 (binaries for matlab R2014b, windows) on https://github.com/casadi/casadi/wiki/InstallationInstructions and copy the file to a folder.
  2. Add to the SYSTEM environmental variable path (so not your local environmental variable path) the path C:\Users\u0085306\Documents\work\casadi-matlabR2014b-v2.4.2. It can be that if you install mingw or msys without administrator rights, adding it to the local environmental variables is sufficient.
  3. Install MinGw-w64 a) downloading x86_64-4.9.2-release-win32-seh-rt_v4-rev4 from https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-win32/seh/ (first link, 2015-09-01) b) unzip it c) make a folder: C:\MinGW and copy all files from x86_64-4.9.2-release-win32-seh-rt_v4-rev4\mingw64 to C:\MinGW\
  4. Install MSys (instructions are on http://www.mingw.org/wiki/msys)
  5. Download the rocket example and copy it to a test folder
  6. Open MSys and use the following code to build rocket_ipopt.cpp (adapth your path. Test is the folder containing rocket_ipopt.cpp): cd "C:\Users\u0085306\Documents\work\ccode\Casadi\Test" g++ -I"C:/Users/u0085306/Documents/work/casadi-matlabR2014b-v2.4.2/include" -DUSE_CXX11 -std=c++11 -fPIC -std=c++11 rocket_ipopt.cpp -o rocket -L"C:/Users/u0085306/Documents/work/casadi-matlabR2014b-v2.4.2" -lcasadi -lstdc++ -lcasadi This should compile the cpp code rocket_ipopt.cpp to rocket.exe.
  7. Run rocket.exe by typing rocket
  8. Check that the program also run if you double click on rocket.exe