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

Author Topic: SFML library link problem  (Read 8197 times)

0 Members and 1 Guest are viewing this topic.

tobbeman

  • Newbie
  • *
  • Posts: 12
    • View Profile
SFML library link problem
« on: August 18, 2013, 11:56:25 am »
Hi, first time posting

Recently downloaded SFML but haven't gotten it to work, whenever i'm using the code found in the toturial i'm getting errors:

obj\Debug\Untitled2.o||In function `main':|
C:\SpelProgram\Test\Test\Untitled2.cpp|5|undefined reference to `sf::String::String(char const*, std::locale const&)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|5|undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|5|undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|6|undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|7|undefined reference to `sf::Color::Green'|
C:\SpelProgram\Test\Test\Untitled2.cpp|7|undefined reference to `sf::Shape::setFillColor(sf::Color const&)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|15|undefined reference to `sf::Window::close()'|
C:\SpelProgram\Test\Test\Untitled2.cpp|12|undefined reference to `sf::Window::pollEvent(sf::Event&)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|18|undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|18|undefined reference to `sf::RenderTarget::clear(sf::Color const&)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|19|undefined reference to `sf::RenderStates::Default'|
C:\SpelProgram\Test\Test\Untitled2.cpp|19|undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'|
C:\SpelProgram\Test\Test\Untitled2.cpp|20|undefined reference to `sf::Window::display()'|
C:\SpelProgram\Test\Test\Untitled2.cpp|9|undefined reference to `sf::Window::isOpen() const'|
C:\SpelProgram\Test\Test\Untitled2.cpp|23|undefined reference to `sf::RenderWindow::~RenderWindow()'|
C:\SpelProgram\Test\Test\Untitled2.cpp|5|undefined reference to `sf::RenderWindow::~RenderWindow()'|
C:\SpelProgram\Test\Test\Untitled2.cpp|23|undefined reference to `sf::RenderWindow::~RenderWindow()'|
obj\Debug\Untitled2.o||In function `ZN2sf11CircleShapeD1Ev':|
C:\SFML-2.1\include\SFML\Graphics\CircleShape.hpp|41|undefined reference to `vtable for sf::CircleShape'|
C:\SFML-2.1\include\SFML\Graphics\CircleShape.hpp|41|undefined reference to `vtable for sf::CircleShape'|
C:\SFML-2.1\include\SFML\Graphics\CircleShape.hpp|41|undefined reference to `sf::Shape::~Shape()'|
||=== Build finished: 20 errors, 0 warnings (0 minutes, 0 seconds) ===|

After lurking around i've come to the conclusion I'm linking the library wrong somehow, however I've already tried doing the installation all over again following the toturiol as close as I can with no result.

I'm using the static libraries

Any help/or insight would be appreciated

-tobbe

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

tobbeman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: SFML library link problem
« Reply #2 on: August 21, 2013, 02:51:24 pm »
Thanks for the reply but I have already done what you describe, it's in the first post :S

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML library link problem
« Reply #3 on: August 21, 2013, 03:09:21 pm »
Then you obviously didn't understand what was written in that thread. You provided the error log, nothing else. Until you provide the command line as well nobody can help you.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

tobbeman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: SFML library link problem
« Reply #4 on: August 23, 2013, 06:24:21 pm »
Ah, sorry, Here you go:



-------------- Build: Debug in Test (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -LC:\SFML-2.1\lib  -o bin\Debug\Test.exe obj\Debug\Untitled2.o    -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d
obj\Debug\Untitled2.o: In function `main':
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:6: undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
C:/SpelProgram/Test/Test/Untitled2.cpp:7: undefined reference to `sf::Color::Green'
C:/SpelProgram/Test/Test/Untitled2.cpp:7: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:15: undefined reference to `sf::Window::close()'
C:/SpelProgram/Test/Test/Untitled2.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:18: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
C:/SpelProgram/Test/Test/Untitled2.cpp:18: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:19: undefined reference to `sf::RenderStates::Default'
C:/SpelProgram/Test/Test/Untitled2.cpp:19: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:20: undefined reference to `sf::Window::display()'
C:/SpelProgram/Test/Test/Untitled2.cpp:9: undefined reference to `sf::Window::isOpen() const'
C:/SpelProgram/Test/Test/Untitled2.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/SpelProgram/Test/Test/Untitled2.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
obj\Debug\Untitled2.o: In function `ZN2sf11CircleShapeD1Ev':
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `sf::Shape::~Shape()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
20 errors, 0 warnings (0 minutes, 1 seconds)
 

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML library link problem
« Reply #5 on: August 23, 2013, 07:57:08 pm »
Do a Rebuild and post the log.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

tobbeman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: SFML library link problem
« Reply #6 on: August 25, 2013, 06:18:12 pm »

-------------- Clean: Debug in Test (compiler: GNU GCC Compiler)---------------

Cleaned "Test - Debug"

-------------- Build: Debug in Test (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -DSFML_STATIC  -g    -IC:\SFML-2.1\include  -c C:\SpelProgram\Test\Test\Untitled2.cpp -o obj\Debug\Untitled2.o
mingw32-g++.exe -LC:\SFML-2.1\lib  -o bin\Debug\Test.exe obj\Debug\Untitled2.o    -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d
obj\Debug\Untitled2.o: In function `main':
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:6: undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
C:/SpelProgram/Test/Test/Untitled2.cpp:7: undefined reference to `sf::Color::Green'
C:/SpelProgram/Test/Test/Untitled2.cpp:7: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:15: undefined reference to `sf::Window::close()'
C:/SpelProgram/Test/Test/Untitled2.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:18: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
C:/SpelProgram/Test/Test/Untitled2.cpp:18: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:19: undefined reference to `sf::RenderStates::Default'
C:/SpelProgram/Test/Test/Untitled2.cpp:19: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
C:/SpelProgram/Test/Test/Untitled2.cpp:20: undefined reference to `sf::Window::display()'
C:/SpelProgram/Test/Test/Untitled2.cpp:9: undefined reference to `sf::Window::isOpen() const'
C:/SpelProgram/Test/Test/Untitled2.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/SpelProgram/Test/Test/Untitled2.cpp:5: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/SpelProgram/Test/Test/Untitled2.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
obj\Debug\Untitled2.o: In function `ZN2sf11CircleShapeD1Ev':
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `sf::Shape::~Shape()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 6 seconds)
20 errors, 0 warnings (0 minutes, 6 seconds)
 
looks pretty much the same to me

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML library link problem
« Reply #7 on: August 26, 2013, 07:23:09 pm »
Do the examples provided with SFML (in the examples folder) work?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

tobbeman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: SFML library link problem
« Reply #8 on: August 26, 2013, 08:13:51 pm »
They do, both the .exe and opening the file in codeblocks and running works

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML library link problem
« Reply #9 on: August 26, 2013, 09:59:01 pm »
Code: [Select]
mingw32-g++.exe -LC:\SFML-2.1\lib  -o bin\Debug\Test.exe obj\Debug\Untitled2.o    -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-dThis line looks screwed up to me. The output executable name should normally come after the -o instead of the linker input files. Check whether your output filename is set properly in your project properties.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

tobbeman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: SFML library link problem
« Reply #10 on: August 27, 2013, 12:00:41 pm »
Hmm, first of all I'm not sure that I'm at the right place, though it seems I've found some sort of error,

the output in release is pointing towards a folder thats dosen't exist, and they both (release and debug) point towards an .exe that dosen't exist either


some pictures:


« Last Edit: August 27, 2013, 12:12:17 pm by tobbeman »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: SFML library link problem
« Reply #11 on: August 27, 2013, 02:31:10 pm »
the output in release is pointing towards a folder thats dosen't exist, and they both (release and debug) point towards an .exe that dosen't exist either
If it's the first time you compile stuff, it will be created. So you're basically saying: "Create my executable in the directory X with the filename Y."
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

tobbeman

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: SFML library link problem
« Reply #12 on: August 27, 2013, 03:08:30 pm »
Aha, meaning i have to correctly build to create any files? Well that explains that atleast

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: SFML library link problem
« Reply #13 on: August 27, 2013, 03:11:11 pm »
Aha, meaning i have to correctly build to create any files? Well that explains that atleast
Yes. As long as the compiler spits out errors, you won't end up with an executable. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML library link problem
« Reply #14 on: August 27, 2013, 03:49:52 pm »
Did you try creating and building a normal "Hello World" console project in Code::Blocks? If that doesn't even work, you should fix that first before trying SFML.

Edit: And exactly (full name) which version of SFML did you download?
« Last Edit: August 27, 2013, 03:54:05 pm by binary1248 »
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).