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

Author Topic: Can't compile the Window sample  (Read 6331 times)

0 Members and 1 Guest are viewing this topic.

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« on: October 10, 2011, 02:41:05 am »
Hey ya fellows, I'm doing some tests with the SFML engine, so I tried to compile some samples with no success. Like when I was trying to compile the Window.cpp I received the following error:

C:\SFML-1.6\samples\window\Window.o:Window.cpp|| undefined reference to `gluPerspective@32'|
||=== Build finished: 1 errors, 0 warnings ===|

If you don't know what sample I'm talking about, its this one: http://pastebin.com/MBTfymnb
Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't compile the Window sample
« Reply #1 on: October 10, 2011, 07:41:06 am »
You must link to the GLU library ("-lGLU" with gcc, "glu32.lib" for VC++).
Laurent Gomila - SFML developer

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« Reply #2 on: October 10, 2011, 05:24:31 pm »
Quote from: "Laurent"
You must link to the GLU library ("-lGLU" with gcc, "glu32.lib" for VC++).


I linked it to the "libglu32.a" file I found in my MinGW directory and it worked well. By the way, If you can answer me, why is the window.exe asking for the DLLs "sfml-window.dll", "sfml-system.dll" and "libgcc_s_dw2-1.dll" if in the previous compiled .exe it just asked for "libsndfile-1.dll" and "openal32.dll"? Sorry my foolery, I'm really just a beginner developer, its the first engine I'm using.
Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't compile the Window sample
« Reply #3 on: October 10, 2011, 05:29:11 pm »
Quote
By the way, If you can answer me, why is the window.exe asking for the DLLs "sfml-window.dll", "sfml-system.dll" and "libgcc_s_dw2-1.dll" if in the previous compiled .exe it just asked for "libsndfile-1.dll" and "openal32.dll"?

Probably because the first one links to dynamically to SFML, while the second one links statically.
Laurent Gomila - SFML developer

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« Reply #4 on: October 10, 2011, 05:49:09 pm »
Quote from: "Laurent"
Quote
By the way, If you can answer me, why is the window.exe asking for the DLLs "sfml-window.dll", "sfml-system.dll" and "libgcc_s_dw2-1.dll" if in the previous compiled .exe it just asked for "libsndfile-1.dll" and "openal32.dll"?

Probably because the first one links to dynamically to SFML, while the second one links statically.


Sorry pal, but I'm kinda confused. I'm linking it to all the SFML libraries, what should I do?
Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't compile the Window sample
« Reply #5 on: October 10, 2011, 05:57:55 pm »
Quote
I'm linking it to all the SFML libraries

What does it mean? Can you show the list of the libraries you link to?
Laurent Gomila - SFML developer

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« Reply #6 on: October 10, 2011, 05:59:53 pm »
Quote from: "Laurent"
Quote
I'm linking it to all the SFML libraries

What does it mean? Can you show the list of the libraries you link to?


Sure.

Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't compile the Window sample
« Reply #7 on: October 10, 2011, 06:15:31 pm »
Oh my god :shock:

Have you read the tutorial? Files with suffixes such as -d or -s represent a different version of the same library, and have a very specific purpose (-d for debug, -s for static). You must only link to one version of the libraries, according to how you want to link to SFML ;)
Laurent Gomila - SFML developer

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« Reply #8 on: October 10, 2011, 07:23:38 pm »
Quote from: "Laurent"
Oh my god :shock:

Have you read the tutorial? Files with suffixes such as -d or -s represent a different version of the same library, and have a very specific purpose (-d for debug, -s for static). You must only link to one version of the libraries, according to how you want to link to SFML ;)


Sorry pal, my english is kinda bad so I'm always missing something. xD Now I linked just the main ones, but again I can't compile the code.



I'm receiving the following error log: http://pastebin.com/a1rYC209
Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't compile the Window sample
« Reply #9 on: October 10, 2011, 10:16:41 pm »
If you use OpenGL you must link to the OpenGL library as well (-lGL).
Laurent Gomila - SFML developer

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« Reply #10 on: October 10, 2011, 11:01:55 pm »
Quote from: "Laurent"
If you use OpenGL you must link to the OpenGL library as well (-lGL).


Aren't you talking about the "libglu32.a"? If you're not, I wasn't linking nothing different before, just the SMFL ones and the "libglu32.a", and it was working well. Sorry if I'm being annoying or stuff like this, I'm really confused over here. But if I'll use the OpenGL library, how should I link it?
Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't compile the Window sample
« Reply #11 on: October 10, 2011, 11:08:02 pm »
First, you should link libraries with "xxx" instead of "full/path/libxxx.a".

Add the path to SFML libraries to the linker search directories, and then link to "sfml-system", "sfml-graphics". There's no path to setup for standard libraries, they are in... standard paths. So just link to "glu32" and "opengl32".
Laurent Gomila - SFML developer

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« Reply #12 on: October 10, 2011, 11:47:37 pm »
Quote from: "Laurent"
First, you should link libraries with "xxx" instead of "full/path/libxxx.a".

Add the path to SFML libraries to the linker search directories, and then link to "sfml-system", "sfml-graphics". There's no path to setup for standard libraries, they are in... standard paths. So just link to "glu32" and "opengl32".


So I did, is it alright?


Well, if it is, I'm getting another log error when compiling: http://pastebin.com/3jd5pGzq
Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Can't compile the Window sample
« Reply #13 on: October 11, 2011, 12:33:27 am »
I think you also need to link to sfml-window seeing as you are using Window

TeLMo

  • Newbie
  • *
  • Posts: 16
    • MSN Messenger - thvs2live.it
    • View Profile
Can't compile the Window sample
« Reply #14 on: October 11, 2011, 12:48:23 am »
Quote from: "sbroadfoot90"
I think you also need to link to sfml-window seeing as you are using Window


Not it worked well, thanks you both fellows. But returning to the other point of the conversation:

Quote from: "Laurent"
Quote
By the way, If you can answer me, why is the window.exe asking for the DLLs "sfml-window.dll", "sfml-system.dll" and "libgcc_s_dw2-1.dll" if in the previous compiled .exe it just asked for "libsndfile-1.dll" and "openal32.dll"?

Probably because the first one links to dynamically to SFML, while the second one links statically.


I yet couldn't understand how to fix it.  :?
Zombie Offensive - Development blog
http://zombieoffensive.blogspot.com/