I downloaded the FMUSDK and I want to compile the code. Unfortunately the build script is supposed to work with the Visual Studio C compiler, but I can't install/use it on my machine. Thus, I try to modify the script (and some parts of the code) to be able to compile it with the GCC. But I am completely new to compiling complex code (I usually just use gcc *.c -o outfile.exe)
Here is my problem: In some files there is a library linked with
#pragma comment(lib, "libxml2.lib")
This does not work with GCC.
The lib can be found in ..\shared\parser\libxml2.lib
with headers files in ..\shared\parser\libxml\
I call the build script with
fmusdk\fmu20\src\co_simulation>..\build_fmusim_cs_gcc.bat
The script then looks like this:
set SRC=main.c ..\shared\sim_support.c ..\shared\xmlVersionParser.c ..\shared\parser\XmlParser.cpp ..\shared\parser\XmlElement.cpp ..\shared\parser\XmlParserCApi.cpp
set INC=-I ..\shared\include -I ..\shared -I ..\shared\parser\libxml -I ..\shared\parser
set LIB=-L ..\shared\include -L ..\shared -L ..\shared\parser\libxml -L ..\shared\parser
set OPTIONS=-D FMI_COSIMULATION -D STANDALONE_XML_PARSER -D LIBXML_STATIC -v
g++ %INC% %OPTIONS% %SRC% %LIB% -lxml2 -o fmu20sim_cs.exe
But I get the following error message:
c:/users/<username>/userprograms/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lxml2
I tried to use what I found on http://www.rapidtables.com/code/linux/gcc/gcc-l.htm, but I seems not to work.
Can someone help? What am I doing wrong? Under INC and LIB I put everything that looked helpful, but I have no idea what I am really doing there ...
I have also a logfile with the verbose output of the batch file. But I don't see how to upload it here :(
Best regards, Martin