Question regarding making libraries
Posted: Sat Mar 30, 2013 1:35 am
I have a few questions as well as a few errors when trying to make a library, I'd like to appologise in advance if I come off as stupid, but I'm very new to g++ and CodeLite in general, I come from a very protective Microsoft Visual C++ where a lot of things happened automagically so try to have some understanding and don't judge me too hard.
So here is my specs:
OS - Windows 7
IDE - CodeLite 5.1
1) When making a g++ shared dynamic library I get an *.so file instead of an .dll file and a lib file to link against.
I'v come to terms that you link against an *.so file and then you can rename it and use it as a .dll file for the .exe
Have I grasped this correctly?
2) Is there an easy way to alternate between an static and shared build? Currently I'm running two projects.
3)Vildhjarta that is my library uses files from SFML to work, I link to SFML statically and it outputs a rather large .so file, which is understandable but also I don't need to link to SFML when linking to my library seeing as it includes all the necessary classes from the SFML library to run.
This is not a problem mostly a curiosity.
When doing my .dll file in Microsoft Visual C++ the library ( even when statically linking ) outputs a minimal version of the .dll file and still requires me to link towards SFML in addition to my own library when using it in a project.
How do I mimic that behavior in g++? If I can? Basically I need to use the SFML library when compiling my own library, but I don't want to link dynamically because that would mean I would require to have SFML present as .dll files? Or would it detect an statically linked SFML? It makes me confused.
Making a dynamic shared library is all good but trying to make a static version of it fails.
Here is the output:
So here is my specs:
OS - Windows 7
IDE - CodeLite 5.1
1) When making a g++ shared dynamic library I get an *.so file instead of an .dll file and a lib file to link against.
I'v come to terms that you link against an *.so file and then you can rename it and use it as a .dll file for the .exe
Have I grasped this correctly?
2) Is there an easy way to alternate between an static and shared build? Currently I'm running two projects.
3)Vildhjarta that is my library uses files from SFML to work, I link to SFML statically and it outputs a rather large .so file, which is understandable but also I don't need to link to SFML when linking to my library seeing as it includes all the necessary classes from the SFML library to run.
This is not a problem mostly a curiosity.
When doing my .dll file in Microsoft Visual C++ the library ( even when statically linking ) outputs a minimal version of the .dll file and still requires me to link towards SFML in addition to my own library when using it in a project.
How do I mimic that behavior in g++? If I can? Basically I need to use the SFML library when compiling my own library, but I don't want to link dynamically because that would mean I would require to have SFML present as .dll files? Or would it detect an statically linked SFML? It makes me confused.
Making a dynamic shared library is all good but trying to make a static version of it fails.
Here is the output:
It tells me that it failed and that my graphical libraries is not in the location, but they are it works for dynamic building but not static.C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 4 -e -f "Vildhjarta_wsp.mk""
"----------Building project:[ VildhjartaStatic - Debug ]----------"
mingw32-make.exe[1]: Entering directory `C:/Users/Victor/Documents/CodeLite/Vildhjarta/VildhjartaSTATIC'
codelitegcc g++ -c "C:/Users/Victor/Documents/CodeLite/Vildhjarta/Vildhjarta/Game.cpp" -g -DSFML_STATIC -o ./Debug/Vildhjarta_Game.o -I. -I"C:/SFML 2.0 15 FEB/include"
ar rcus ./Debug/libVildhjartaStatic.a @"VildhjartaStatic.txt" "libsfml-graphics-s-d" "libsfml-window-s-d" "libsfml-audio-s-d" "libsfml-network-s-d" "libsfml-system-s-d" "libsfml-main-d"
ar: libsfml-graphics-s-d: No such file or directory
mingw32-make.exe[1]: *** [Debug/libVildhjartaStatic.a] Error 1
mingw32-make.exe: *** [All] Error 2
VildhjartaStatic.mk:80: recipe for target `Debug/libVildhjartaStatic.a' failed
mingw32-make.exe[1]: Leaving directory `C:/Users/Victor/Documents/CodeLite/Vildhjarta/VildhjartaSTATIC'
Vildhjarta_wsp.mk:4: recipe for target `All' failed
0 errors, 0 warnings