|
Having trouble with static linking |
Michael Weiss
Member #223
April 2000
|
I am new to static linking, have always used dynamic with no problem. - First of all, what are the advantages of static vs dynamic? - Second, what extra files do I need to include with my game? With dynamic it seems I need: I don't know what static will require as I havent been able to get it working yet. I am using: mingw-w64 Allegro 5.2.4 (from source) Code::Blocks 17.12 I built both the dynamic and static monolith debug release versions of allegro The only thing I did different for static was uncheck the SHARED flag in CMake I changed the linker library list from: to: I also set these compiler flags: My project compiles, links and runs fine with dynamic linking. There seem to be 2 things linker can't find: fixed point routines in fmaths.inl: and opus stuff: I am lost here. I don't know how to fix these errors. Any advice on static vs dynamic as it applies to Allegro would be greatly appreciated. Do I even want or need to do this? EDIT: I just figured out the opus stuff.. I copied libopus.a and libopusfile.a from the dependencies still have the fmaths.inl errors...
|
Neil Roy
Member #2,229
April 2002
|
My own linker settings I use to compile my Allegro 5 game Deluxe Pacman 2 are the following, in order I have them in Code::Blocks. My game statically links without problems. I built this version of Allegro myself as well (which was a first for me, yay). Edit: all under Windows 7 mingw32 dumb FLAC vorbisfile vorbis freetype ogg physfs png16 zlibstatic gdiplus uuid kernel32 winmm psapi opengl32 glu32 user32 comdlg32 gdi32 shell32 ole32 advapi32 ws2_32 shlwapi dsound jpeg opusfile opus allegro_monolith-static or allegro_monolith-debug-static I also have the following on the side for other linker options; -static -static-libgcc
--- |
Elias
Member #358
May 2000
|
I think you have to also compile your code with -DALLEGRO_STATICLINK, that could explain the fmaths error. -- |
Michael Weiss
Member #223
April 2000
|
Thanks Neil, I actually found a old post of your with that linker list that I was comparing to mine... Thanks Elias, Using -DALLEGRO_STATICLINK worked
|
Neil Roy
Member #2,229
April 2002
|
I usually just have: #define ALLEGRO_STATICLINK at the top of one or more of my source files, didn't mention it. Never thought to use the command line argument. Edit: Yeah, I just changed my own code to use -DALLEGRO_STATICLINK as an argument instead and it works. I like that better. The next time someone needs help, I can include that in my list of arguments I post here. Seems like the safer bet than remembering if you included it in your code somewhere. --- |
|