Hopsan
|
When your code is finished, the project must be compiled. It is necessary to use the same compiler that your version of Hopsan was compiled with. The project must also be compiled in release mode unless you are building against a debug compiled version of the HopsanCore in debug mode.
There are two ways of compiling your library:
The simple way:
The less simple way:
Hopsan/HopsanCore/include
and the linker path to Hopsan/bin
. You must use the intended Hopsan version, so if you have multiple versions installed in different places you must change these when switching version.Compiling and Linking:
The compilation goes through two phases, first the .cpp file(s) are compiled and then they are linked into a shared object .dll, .so or .dynlib file that will appear in your library directory.
If something is wrong in your code you may get compilation errors in the first phase, you will need to correct those before the linking step can proceed. You should also pay attention to warnings, they may indicate that your code will not produce the expected result. The error and warning messages are usually quite descriptive and points to the line where the problem comes from.
You may also get linker errors which are a bit more difficult to understand if you are not used to compiling you own code. If you get something similar to the following error message: "cannot find -lhopsancore"
you have probably set the LIBS path incorrectly in your Qt project file. It should point to where the HopsanCore .dll, .so, .dynlib file is located. Also specify the correct release or debug HopsanCore file -lhopsancore
or -lhopsancore_d
ToDo: This section should list common compilation and linking errors and who to solve them