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

Author Topic: SFML firt exemple static compilation  (Read 1517 times)

0 Members and 1 Guest are viewing this topic.

paulochon

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML firt exemple static compilation
« on: December 31, 2014, 04:33:30 am »
Hi
Just to bring my 5 penny to the pot...
I just installed SFML and was trying a static compilation (Using Dev-Cpp and 64 bits versions) of the exemple provided in the tut.

i first get into troubles with linkage errors like
D:\SFML-2.2-gcc481-64bit\lib\libsfml-window-s.a(Window.cpp.obj)   Window.cpp:(.text+0x16d): undefined reference to `sf::Clock::Clock()'
........................
or
D:\SFML-2.2-gcc481-64bit\lib\libsfml-graphics-s.a(RenderWindow.cpp.obj)   RenderWindow.cpp:
(.text+0x385): undefined reference to `glReadPixels'
...................................

After googling on the web ,
- i realized that the importance of the order of lib declaration
- Also i made a mistake using glew instead of glew32

After various trial and error , i finally ended with the right config that could help others
so in the section parameters / Linker section, i added
-lsfml-graphics-s
-lsfml-window-s
-lsfml-system-s
-ljpeg
-lglew32
-lfreetype
-lgdi32
-lopengl32
-lwinmm

in the parameters / C++:
-DSFML_STATIC

and of course, in directories/library dirtectories:
D:\SFML-2.2-gcc481-64bit\lib

and include/library dirtectories:
D:\SFML-2.2-gcc481-64bit\include


everything worked perfectly after that
Hope it ll help

Cheers

Nota: Dont know why Dev-cpp uses this kind of declaration , instead of just
sfml-graphics-s
sfml-window-s
sfml-system-s
jpeg
...

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: SFML firt exemple static compilation
« Reply #1 on: December 31, 2014, 04:40:59 am »
The -l is the option you would pass to a command line compiler like gcc.  All IDEs eventually run a compiler with some messy command line so I guess Dev-Cpp simply decided the -l's should be present in its GUI as well.

Aside from that, this looks like a summary of what the official tutorials say.  I know there isn't a tutorial specifically for Dev-Cpp, but was there anything particularly confusing or misleading about the existing tutorials that prompted you to write this post? Or was it just that difficult to adapt those directions to Dev-Cpp?

paulochon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SFML firt exemple static compilation
« Reply #2 on: December 31, 2014, 04:53:10 am »
Yep u right, its a wrap up but its more a help for Dev-Cpp guys since the tut provided led me to errors.
I followed the tut on code:blocks but at first i just put the 3 lib (graphic, window, system) and thought it was enough. then I added the missing lib (jpeg, freetype. etc...) but got still errors due to the fact that the tut was giving glew , instead of glew32 and also i was putting those extra lib before the sfml-xxx libs instead of after them. So before reaching the right config i got errors and was trying different combinations, that the purpose of my post , to provide the right config for the guys in the same situation.

Cheers

Incantrix

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: SFML first exemple static compilation
« Reply #3 on: January 28, 2015, 04:08:13 pm »
Well, I for one appreciate it.  The setup tutorial should really give the full order of linking for all modules. 

I thought I would quick search the forums here before playing shuffle myself to see if someone else had the same order issue.  Voila!  Someone did, thanks paulochon.


 

anything