Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem compiling SFML 2.0 program  (Read 8063 times)

0 Members and 1 Guest are viewing this topic.

aeron

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - aeron005@gmail.com
    • View Profile
    • http://aeron.uni.cc/
Problem compiling SFML 2.0 program
« on: February 03, 2011, 11:28:24 pm »
I followed the instructions to build SFML 2.0 with CMake and it seemed to work without a problem. So now I try to compile against the library but I keep getting errors:
Code: [Select]
obj\Debug\Game.o: In function `Game':
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKSsmRKNS_15ContextSettingsE'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:14: undefined reference to `_imp___ZN2sf6Window17SetFramerateLimitEj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:27: undefined reference to `_imp___ZN2sf5ImageC1Ev'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:28: undefined reference to `_imp___ZN2sf5Image12LoadFromFileERKSs'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:30: undefined reference to `_imp___ZN2sf5Image9SetSmoothEb'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKSsmRKNS_15ContextSettingsE'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:14: undefined reference to `_imp___ZN2sf6Window17SetFramerateLimitEj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:27: undefined reference to `_imp___ZN2sf5ImageC1Ev'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:28: undefined reference to `_imp___ZN2sf5Image12LoadFromFileERKSs'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:30: undefined reference to `_imp___ZN2sf5Image9SetSmoothEb'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:58: undefined reference to `_imp___ZN2sf6Window5CloseEv'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:55: undefined reference to `_imp___ZN2sf6Window8GetEventERNS_5EventE'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:60: undefined reference to `_imp___ZNK2sf6Window8GetInputEv'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:63: undefined reference to `_imp___ZN2sf5Color5BlackE'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:63: undefined reference to `_imp___ZN2sf12RenderTarget5ClearERKNS_5ColorE'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:65: undefined reference to `_imp___ZN2sf6Window7DisplayEv'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:52: undefined reference to `_imp___ZNK2sf6Window8IsOpenedEv'
collect2: ld returned 1 exit status


So yeah, what might cause this? The program is trivially simple, it's just a basic game loop at the moment. I have the compiler/linker search directories set correctly and everything, and I'm using the exact same compiler I used to compile SFML (TDM-GCC). Using SVN revision 1786

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem compiling SFML 2.0 program
« Reply #1 on: February 03, 2011, 11:43:13 pm »
Are you linking statically?
Laurent Gomila - SFML developer

aeron

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - aeron005@gmail.com
    • View Profile
    • http://aeron.uni.cc/
Problem compiling SFML 2.0 program
« Reply #2 on: February 03, 2011, 11:45:59 pm »
Yes.

Edit: Strangely enough, compiling against the dynamic libraries works just fine.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem compiling SFML 2.0 program
« Reply #3 on: February 03, 2011, 11:49:25 pm »
Not strangely. Static linking requires the SFML_STATIC preprocessor macro to be defined.
Laurent Gomila - SFML developer

aeron

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - aeron005@gmail.com
    • View Profile
    • http://aeron.uni.cc/
Problem compiling SFML 2.0 program
« Reply #4 on: February 03, 2011, 11:56:26 pm »
Ah sounds familiar, but.. Did you always have to do this? I can't remember if I had to use it in 1.7 or not. Regardless, it's working great now, thanks for the help Laurent!

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Problem compiling SFML 2.0 program
« Reply #5 on: February 04, 2011, 01:52:16 am »
There isn't a 1.7. And it's new to SFML2.
I use the latest build of SFML2

bmn

  • Newbie
  • *
  • Posts: 18
    • View Profile
Problem compiling SFML 2.0 program
« Reply #6 on: February 04, 2011, 03:38:55 am »
Quote from: "OniLink10"
There isn't a 1.7. And it's new to SFML2.


The Download Page list the latest non SFML2 trunk as SFML 1.7

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem compiling SFML 2.0 program
« Reply #7 on: February 04, 2011, 07:29:38 am »
In SFML 1.x it was SFML_DYNAMIC for dynamic libraries.

SFML 1.7 will never exist, but that's how the current trunk is named, until the sfml2 branch is merged into it.
Laurent Gomila - SFML developer

aeron

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - aeron005@gmail.com
    • View Profile
    • http://aeron.uni.cc/
Problem compiling SFML 2.0 program
« Reply #8 on: February 04, 2011, 09:06:54 am »
Quote

The Download Page list the latest non SFML2 trunk as SFML 1.7

Yeah that's what I checked but I meant 1.6.

Quote
In SFML 1.x it was SFML_DYNAMIC for dynamic libraries.

Sounds right, that's what I was thinking about.

christian.kelvin10

  • Newbie
  • *
  • Posts: 3
    • View Profile
problem compiling SFML 2.0 program
« Reply #9 on: March 12, 2011, 02:42:44 pm »
I am trying to use your particle engine with Sfml and got some problems. I have the exact same code as in tutorial 2  and linked all right. Static SFML libraries and static libraries to IGNITE. There are no linker error, but when I try to compile it is a strange error without assistance:

 

anything