SFML community forums

Help => General => Topic started by: The Terminator on December 25, 2013, 04:03:28 pm

Title: Having a bit of a problem with setting up the environment on another PC
Post by: The Terminator on December 25, 2013, 04:03:28 pm
Hello there, and Merry Christmas to everybody  :). I'm having a bit of an issue with setting up SFML 2.1 on another PC, which isn't working for me, yet my other PC works fine and I'm doing the same process. I've compiled SFML 2.1 on CodeBlocks' default compiler (GCC 4.7.1) which comes along just fine. Now, when I link everything, CodeBlocks spits out all these nasty errors like:

undefined reference to `_imp___ZN2sf12RenderWindowC1Ev'|

Etc. Does anyone have an idea what could be causing the error? Thanks a lot for any and all help!
Title: AW: Having a bit of a problem with setting up the environment on another PC
Post by: eXpl0it3r on December 26, 2013, 05:37:36 pm
It means you're linking the wrong library. Post the full build command as explained in the sticky thread in General Help here.
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: The Terminator on December 27, 2013, 05:09:50 am
-------------- Build: Debug in Shock Engine (compiler: GNU GCC Compiler)---------------

WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\Engine\ShockScript\ParticleSystemParser.cpp
WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\GUI\ParticleSystem.cpp
WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\GUI\ParticleSystemManager.cpp
mingw32-g++.exe -L"..\..\..\..\Program Files (x86)\SFML\lib" -L"..\..\..\..\Program Files (x86)\thor\lib"  -o "bin\Debug\Shock Engine.exe" obj\Debug\main.o obj\Debug\Shock_Engine\Engine\Engine.o obj\Debug\Shock_Engine\Engine\ShockScript\GUIParser.o obj\Debug\Shock_Engine\Engine\ShockScript\Parser.o obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o obj\Debug\Shock_Engine\Gameplay\Camera.o obj\Debug\Shock_Engine\Gameplay\ObjectManager.o obj\Debug\Shock_Engine\Gameplay\Player.o obj\Debug\Shock_Engine\GUI\Background.o obj\Debug\Shock_Engine\GUI\Button.o obj\Debug\Shock_Engine\GUI\FPS.o obj\Debug\Shock_Engine\GUI\GUI.o obj\Debug\Shock_Engine\GUI\GUIObject.o obj\Debug\Shock_Engine\GUI\Label.o obj\Debug\Shock_Engine\GUI\ParticleSystem.o obj\Debug\Shock_Engine\GUI\ParticleSystemManager.o obj\Debug\Shock_Engine\GUI\RadioBox.o obj\Debug\Shock_Engine\States\IntroState.o    -lsfml-audio-d -lsfml-graphics-d -lsfml-window-d -lsfml-system-d -lthor-d
obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o: In function `ZN2SE14ParticleSystem17addTorqueAffectorEf':
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:27: undefined reference to `_imp___ZN4thor14TorqueAffector6createEf'
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:27: undefined reference to `_imp___ZN4thor14ParticleSystem11addAffectorESt10shared_ptrINS_8AffectorEE'
obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o: In function `ZN2SE14ParticleSystem16addForceAffectorEN2sf7Vector2IfEE':
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:30: undefined reference to `_imp___ZN4thor13ForceAffector6createEN2sf7Vector2IfEE'
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:30: undefined reference to `_imp___ZN4thor14ParticleSystem11addAffectorESt10shared_ptrINS_8AffectorEE'
obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o: In function `ZN2SE6Engine24getParticleSystemManagerEv':
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/Engine/Engine.hpp:63: undefined reference to `SE::Engine::m_particleSystemManager'
obj\Debug\Shock_Engine\GUI\ParticleSystem.o: In function `ZN2SE14ParticleSystemC2ERKSs':
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:10: undefined reference to `_imp___ZN4thor16UniversalEmitter6createEv'
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:12: undefined reference to `_imp___ZN4thor14ParticleSystemC1ESt10shared_ptrIKN2sf7TextureEE'
obj\Debug\Shock_Engine\GUI\ParticleSystem.o: In function `ZN2SE14ParticleSystem13createEmitterEffN2sf7Vector2IfEE':
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:24: undefined reference to `_imp___ZN4thor14ParticleSystem10addEmitterESt10shared_ptrINS_7EmitterEE'
obj\Debug\Shock_Engine\GUI\ParticleSystem.o: In function `ZN2SE14ParticleSystem16addFadeAnimationEff':
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:36: undefined reference to `_imp___ZN4thor17AnimationAffector6createESt8functionIFvRNS_8ParticleEfEE'
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:36: undefined reference to `_imp___ZN4thor14ParticleSystem11addAffectorESt10shared_ptrINS_8AffectorEE'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
10 errors, 0 warnings (0 minutes, 0 seconds)
Title: AW: Having a bit of a problem with setting up the environment on another PC
Post by: eXpl0it3r on December 27, 2013, 06:03:30 pm
Thor depends on SFML, thus if needs to come before the SFML libraries in the linking order.
Also make sure you Thor headers and libraries are from the same version. ;)
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: Nexus on December 27, 2013, 08:28:46 pm
To expand on that: Make sure Thor and SFML versions are compatible. The easiest way is to download the most recent Git revisions of both libraries.
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: The Terminator on December 27, 2013, 08:57:18 pm
Ok, I redownloaded everything (SFML 2.1 straight from Github and Thor 2.0 straight from Github) and recompiled everything successfully. I followed the SFML tutorial to the T  (2.1) on correctly linking everything and I got this from the compiler:

-------------- Build: Debug in Shock Engine (compiler: GNU GCC Compiler)---------------

WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\Engine\ShockScript\ParticleSystemParser.cpp
WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\GUI\ParticleSystem.cpp
WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\GUI\ParticleSystemManager.cpp
mingw32-g++.exe -L"C:\Program Files (x86)\SFML\lib" -L"C:\Program Files (x86)\thor\lib"  -o "bin\Debug\Shock Engine.exe" obj\Debug\main.o obj\Debug\Shock_Engine\Engine\Engine.o obj\Debug\Shock_Engine\Engine\ShockScript\GUIParser.o obj\Debug\Shock_Engine\Engine\ShockScript\Parser.o obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o obj\Debug\Shock_Engine\Gameplay\Camera.o obj\Debug\Shock_Engine\Gameplay\ObjectManager.o obj\Debug\Shock_Engine\Gameplay\Player.o obj\Debug\Shock_Engine\GUI\Background.o obj\Debug\Shock_Engine\GUI\Button.o obj\Debug\Shock_Engine\GUI\FPS.o obj\Debug\Shock_Engine\GUI\GUI.o obj\Debug\Shock_Engine\GUI\GUIObject.o obj\Debug\Shock_Engine\GUI\Label.o obj\Debug\Shock_Engine\GUI\ParticleSystem.o obj\Debug\Shock_Engine\GUI\ParticleSystemManager.o obj\Debug\Shock_Engine\GUI\RadioBox.o obj\Debug\Shock_Engine\States\IntroState.o    -lthor-d -lsfml-audio-d -lsfml-graphics-d -lsfml-window-d -lsfml-system-d
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lthor-d
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-audio-d
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-graphics-d
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-window-d
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-system-d
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
5 errors, 0 warnings (0 minutes, 0 seconds)
 

I did some poking around I found that some people were having issues with Windows finding the files. I triple checked that all of my paths were correct, so I see no errors. I'm really stumped on what to do at this point.
Title: AW: Having a bit of a problem with setting up the environment on another PC
Post by: eXpl0it3r on December 27, 2013, 09:11:39 pm
Did you build debug libraries as well? For that you need to rerun CMake with different settings.

The linker can't find libsfml-xyz-d.a
Title: Re: AW: Having a bit of a problem with setting up the environment on another PC
Post by: The Terminator on December 28, 2013, 12:15:05 am
Did you build debug libraries as well? For that you need to rerun CMake with different settings.

The linker can't find libsfml-xyz-d.a

I'm a little bit confused. Do you mean completely reinstall (mingw32-make install) SFML and Thor after I configure and build the corresponding libraries in "debug" mode?
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: eXpl0it3r on December 28, 2013, 12:40:40 am
CMake chooses "Release" by default. If you just build SFML/Thor once, without setting CMAKE_BUILD_TYPE you'll only end up with release libraries and the ones with -d suffix are missing. So if you want to have the debug libraries (with -d suffix) as well, you need to reconfigure CMake and set CMAKE_BUILD_TYPE to "Debug" and then call mingw32-make install again.
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: The Terminator on December 28, 2013, 01:01:08 am
Would I do that for both SFML and Thor? I just did that for Thor and it still doesn't work.
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: eXpl0it3r on December 28, 2013, 01:57:16 am
Of course for both... ::)

You should really learn how linking works.
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: The Terminator on December 28, 2013, 02:49:44 am
Alright, did that, more errors (Yippee!!!!!!!)


-------------- Build: Debug in Shock Engine (compiler: GNU GCC Compiler)---------------

WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\Engine\ShockScript\ParticleSystemParser.cpp
WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\GUI\ParticleSystem.cpp
WARNING: Can't read file's timestamp: C:\Users\Peter Senyszyn\Desktop\Shock Engine\Shock_Engine\GUI\ParticleSystemManager.cpp
mingw32-g++.exe -L"C:\Program Files (x86)\SFML\lib" -L"C:\Program Files (x86)\thor\lib"  -o "bin\Debug\Shock Engine.exe" obj\Debug\main.o obj\Debug\Shock_Engine\Engine\Engine.o obj\Debug\Shock_Engine\Engine\ShockScript\GUIParser.o obj\Debug\Shock_Engine\Engine\ShockScript\Parser.o obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o obj\Debug\Shock_Engine\Gameplay\Camera.o obj\Debug\Shock_Engine\Gameplay\ObjectManager.o obj\Debug\Shock_Engine\Gameplay\Player.o obj\Debug\Shock_Engine\GUI\Background.o obj\Debug\Shock_Engine\GUI\Button.o obj\Debug\Shock_Engine\GUI\FPS.o obj\Debug\Shock_Engine\GUI\GUI.o obj\Debug\Shock_Engine\GUI\GUIObject.o obj\Debug\Shock_Engine\GUI\Label.o obj\Debug\Shock_Engine\GUI\ParticleSystem.o obj\Debug\Shock_Engine\GUI\ParticleSystemManager.o obj\Debug\Shock_Engine\GUI\RadioBox.o obj\Debug\Shock_Engine\States\IntroState.o    -lthor-d -lsfml-audio-d -lsfml-graphics-d -lsfml-window-d -lsfml-system-d
obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o: In function `ZN2SE14ParticleSystem17addTorqueAffectorEf':
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:27: undefined reference to `_imp___ZN4thor14TorqueAffector6createEf'
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:27: undefined reference to `_imp___ZN4thor14ParticleSystem11addAffectorESt10shared_ptrINS_8AffectorEE'
obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o: In function `ZN2SE14ParticleSystem16addForceAffectorEN2sf7Vector2IfEE':
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:30: undefined reference to `_imp___ZN4thor13ForceAffector6createEN2sf7Vector2IfEE'
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/GUI/ParticleSystem.hpp:30: undefined reference to `_imp___ZN4thor14ParticleSystem11addAffectorESt10shared_ptrINS_8AffectorEE'
obj\Debug\Shock_Engine\Engine\ShockScript\ParticleSystemParser.o: In function `ZN2SE6Engine24getParticleSystemManagerEv':
C:\Users\Peter Senyszyn\Desktop\Shock Engine/Shock_Engine/Engine/Engine.hpp:63: undefined reference to `SE::Engine::m_particleSystemManager'
obj\Debug\Shock_Engine\GUI\ParticleSystem.o: In function `ZN2SE14ParticleSystemC2ERKSs':
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:10: undefined reference to `_imp___ZN4thor16UniversalEmitter6createEv'
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:12: undefined reference to `_imp___ZN4thor14ParticleSystemC1ESt10shared_ptrIKN2sf7TextureEE'
obj\Debug\Shock_Engine\GUI\ParticleSystem.o: In function `ZN2SE14ParticleSystem13createEmitterEffN2sf7Vector2IfEE':
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:24: undefined reference to `_imp___ZN4thor14ParticleSystem10addEmitterESt10shared_ptrINS_7EmitterEE'
obj\Debug\Shock_Engine\GUI\ParticleSystem.o: In function `ZN2SE14ParticleSystem16addFadeAnimationEff':
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:36: undefined reference to `_imp___ZN4thor17AnimationAffector6createESt8functionIFvRNS_8ParticleEfEE'
C:/Users/Peter Senyszyn/Desktop/Shock Engine/Shock_Engine/GUI/ParticleSystem.cpp:36: undefined reference to `_imp___ZN4thor14ParticleSystem11addAffectorESt10shared_ptrINS_8AffectorEE'
collect2.exe: error: ld returned 1 exit status

Of course for both... ::)

You should really learn how to linking works.

I know :D. It's a serious hole in my knowledge that I'm trying to fix.
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: Nexus on December 28, 2013, 06:22:04 am
undefined reference to `_imp___ZN4thor14TorqueAffector6createEf'
You're never using the latest Thor revision. thor::TorqueAffector::create() has been removed long ago.
Title: Re: Having a bit of a problem with setting up the environment on another PC
Post by: The Terminator on December 28, 2013, 05:32:31 pm
Ok, I got it all figured out and it works now. Thanks everyone for the help!