|
Problems with linking |
HopeMetal
Member #15,761
October 2014
|
I'm using a Makefile to compile a test program, but my compiler can't finish linking. Here's my cmd output: 1C:\Users\HASWELL\bleh\Allegro\projects\maketest>mingw32-make
2gcc -o main main.o -static-libgcc -static-libstdc++ -L../../lib/ -lallegro-5.0.1
30-monolith-static-mt -lvorbisfile-1.3.2-static-mt -lvorbis-1.3.2-static-mt -ldum
4b-0.9.3-static-mt -lFLAC-1.2.1-static-mt -lfreetype-2.4.8-static-mt -logg-1.2.1-
5static-mt -lzlib-1.2.5-static-mt -lopenal-1.14-static-mt -lgdiplus -luuid -lkern
6el32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -l
7ole32 -ladvapi32 -lws2_32 -lshlwapi
8../../lib//liballegro-5.0.10-monolith-static-mt.a(d3d_display_formats.o):d3d_dis
9play_formats.cpp:(.text+0x948): undefined reference to `___cxa_guard_acquire'
10../../lib//liballegro-5.0.10-monolith-static-mt.a(d3d_display_formats.o):d3d_dis
11play_formats.cpp:(.text+0x968): undefined reference to `___cxa_guard_release'
12../../lib//liballegro-5.0.10-monolith-static-mt.a(d3d_display_formats.o):d3d_dis
13play_formats.cpp:(.text+0x979): undefined reference to `___cxa_guard_acquire'
14../../lib//liballegro-5.0.10-monolith-static-mt.a(d3d_display_formats.o):d3d_dis
15play_formats.cpp:(.text+0x99f): undefined reference to `___cxa_guard_release'
16../../lib//liballegro-5.0.10-monolith-static-mt.a(d3d_display_formats.o):d3d_dis
17play_formats.cpp:(.text+0x9d7): undefined reference to `___cxa_guard_abort'
18../../lib//liballegro-5.0.10-monolith-static-mt.a(d3d_display_formats.o):d3d_dis
19play_formats.cpp:(.text+0x9ed): undefined reference to `___cxa_guard_abort'
20../../lib//liballegro-5.0.10-monolith-static-mt.a(d3d_display_formats.o):d3d_dis
21play_formats.cpp:(.eh_frame+0x63): undefined reference to `___gxx_personality_v0
22'
23collect2.exe: error: ld returned 1 exit status
24mingw32-make: *** [main] Error 1
And my Makefile: 1EXENAME := main
2LIBDIR := ../../lib/
3INCLUDEDIR := ../../include/
4
5LIBS := \
6-lallegro-5.0.10-monolith-static-mt \
7-lvorbisfile-1.3.2-static-mt \
8-lvorbis-1.3.2-static-mt \
9-ldumb-0.9.3-static-mt \
10-lFLAC-1.2.1-static-mt \
11-lfreetype-2.4.8-static-mt \
12-logg-1.2.1-static-mt \
13-lzlib-1.2.5-static-mt \
14-lopenal-1.14-static-mt \
15-lgdiplus \
16-luuid \
17-lkernel32 \
18-lwinmm \
19-lpsapi \
20-lopengl32 \
21-lglu32 \
22-luser32 \
23-lcomdlg32 \
24-lgdi32 \
25-lshell32 \
26-lole32 \
27-ladvapi32 \
28-lws2_32 \
29-lshlwapi
30
31main : main.o
32 gcc -o $(EXENAME) main.o -static-libgcc -static-libstdc++ -L$(LIBDIR) $(LIBS)
33
34main.o : main.c
35 gcc -c -DALLEGRO_STATICLINK -g -I$(INCLUDEDIR) main.c
Any help is appreciated. EDIT: It works fine when I use g++ instead of gcc for the last step. |
Bruce Perry
Member #270
April 2000
|
I assume specifying a C++-related flag (-static-libstdc++) isn't a good move when your code is C. You could keep it as gcc and remove that flag and see if that helps? But then you should check which DLLs the exe depends on of course. -- |
SiegeLord
Member #7,827
October 2006
|
Allegro uses C++ internally on Windows, so you need to link the C++ stdlib, which is easiest accomplished by using g++. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
|