SFML community forums

Help => General => Topic started by: HollaFoil on February 28, 2019, 05:42:12 pm

Title: (Solved... kinda) Undefined reference to '_imp_{manythings}' (Code::Blocks)
Post by: HollaFoil on February 28, 2019, 05:42:12 pm
Even though it's my third time linking SFML, I just keep on getting new linker errors. I downloaded the source code, compiled it (static) for both release and debug. I don't think I forgot any linker/compiler paths, dependencies or flags, or whatever else there is to remember. Though, obviously I screwed up somewhere and I have no clue where..
g++.exe -L"C:\Program Files (x86)\SFML-d\lib" -o bin\Debug\DrawBoard.exe obj\Debug\main.o   -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d -lwinmm -lgdi32 -lopengl32 -lfreetype
obj\Debug\main.o: In function `main':
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:5: undefined reference to `__imp__ZN2sf6StringC1EPKcRKSt6locale'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:5: undefined reference to `__imp__ZN2sf9VideoModeC1Ejjj'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:5: undefined reference to `__imp__ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:6: undefined reference to `__imp__ZN2sf11CircleShapeC1Efy'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:7: undefined reference to `__imp__ZN2sf5Color5GreenE'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:7: undefined reference to `__imp__ZN2sf5Shape12setFillColorERKNS_5ColorE'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:9: undefined reference to `__imp__ZNK2sf6Window6isOpenEv'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:12: undefined reference to `__imp__ZN2sf6Window9pollEventERNS_5EventE'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:15: undefined reference to `__imp__ZN2sf6Window5closeEv'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:18: undefined reference to `__imp__ZN2sf5ColorC1Ehhhh'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:18: undefined reference to `__imp__ZN2sf12RenderTarget5clearERKNS_5ColorE'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:19: undefined reference to `__imp__ZN2sf12RenderStates7DefaultE'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:19: undefined reference to `__imp__ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:20: undefined reference to `__imp__ZN2sf6Window7displayEv'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:5: undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
C:/Users/PC/Desktop/hw/DrawBoard/main.cpp:5: undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
obj\Debug\main.o: In function `sf::CircleShape::~CircleShape()':
C:/Users/PC/Desktop/SFML-2.5.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZTVN2sf11CircleShapeE'
C:/Users/PC/Desktop/SFML-2.5.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZTVN2sf11CircleShapeE'
C:/Users/PC/Desktop/SFML-2.5.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZN2sf5ShapeD2Ev'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
20 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
Title: Re: Undefined reference to '_imp_{manythings}' (Code::Blocks)
Post by: Laurent on February 28, 2019, 05:44:41 pm
-DSFML_STATIC
Title: Re: Undefined reference to '_imp_{manythings}' (Code::Blocks)
Post by: HollaFoil on February 28, 2019, 05:46:49 pm
-DSFML_STATIC
Still the exact same errors :/
Title: Re: Undefined reference to '_imp_{manythings}' (Code::Blocks)
Post by: Laurent on March 01, 2019, 07:54:01 am
Can you show your new command line and compiler log please?
Title: Re: Undefined reference to '_imp_{manythings}' (Code::Blocks)
Post by: HollaFoil on March 02, 2019, 03:00:16 pm
Okay, honestly, I have no idea what is happening. It works... but...

After restarting C::B I found the release target build working. Did some work there. Closed C::B, came back after an hour, now it didn't work, but the debug one did. Literally made 0 changes appart from switching build targets. Hey, it works, I'll leave it.

Btw, -DSFML_STATIC always updated back to SFML_STATIC. -D simply did nothing.
Title: Re: (Solved... kinda) Undefined reference to '_imp_{manythings}' (Code::Blocks)
Post by: Laurent on March 02, 2019, 04:56:34 pm
-D is the command line flag. But if you add the symbol from the Code::Blocks GUI then you don't need it; I guess if you put it anyway then it's smart enough to ignore it.