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

Author Topic: Problem at the beginning  (Read 1029 times)

0 Members and 1 Guest are viewing this topic.

Tomi

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Problem at the beginning
« on: July 18, 2019, 03:22:19 pm »
Hello members!
I'm still new here and now trying to use SFML with Code::Blocks. But I have a problem: when I try to runnig the  sample code (from here: https://www.sfml-dev.org/tutorials/2.5/start-cb.php ), I get the following error message:
||=== Build: Debug in SFMLpelda (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
D:\progsetup\codeblocks-17.12mingw-nosetup\sajatok\SFMLpelda\main.cpp|5|undefined reference to `sf::String::String(char const*, std::locale const&)'|
D:\progsetup\codeblocks-17.12mingw-nosetup\sajatok\SFMLpelda\main.cpp|5|undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
D:\progsetup\codeblocks-17.12mingw-nosetup\sajatok\SFMLpelda\main.cpp|9|undefined reference to `sf::Window::isOpen() const'|
D:\progsetup\codeblocks-17.12mingw-nosetup\sajatok\SFMLpelda\main.cpp|12|undefined reference to `sf::Window::pollEvent(sf::Event&)'|
D:\progsetup\codeblocks-17.12mingw-nosetup\sajatok\SFMLpelda\main.cpp|15|undefined reference to `sf::Window::close()'|
D:\progsetup\codeblocks-17.12mingw-nosetup\sajatok\SFMLpelda\main.cpp|20|undefined reference to `sf::Window::display()'|
||error: ld returned 1 exit status|
||=== Build failed: 7 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

I don't know what is wrong; maybe I did a mistake at the installing of SFML? For example, when I added the libraries to Linker settings/Link libraries, I didn't find sfml-graphics, but instead there are libsfml-graphics.a, and I can't rewrite, because C::B don't let it. Or rather, I have used the "Edit library" option, and I rewrite the name of the file, but the two file is not the same as for names.
Somebody can help me?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Problem at the beginning
« Reply #1 on: July 18, 2019, 06:42:56 pm »
If you follow the tutorial step by step it will work.
You don't need to specify files, as the linker will automatically look for versions with lib prefix and .a suffix.
The order of the libraries is important.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Tomi

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Problem at the beginning
« Reply #2 on: July 24, 2019, 03:52:31 pm »
follow the tutorial step by step
I do so, but it doesn't find sfml-graphics-2.dll file.
I added the paths to the directories exactly, but something is wrong. :(
I used the static version of SFML (-s) and so I wrote the SFML_STATIC macro to #defines to get rid of the DLLs, but it doesn't work.
« Last Edit: July 24, 2019, 04:45:04 pm by Tomi »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problem at the beginning
« Reply #3 on: July 29, 2019, 03:02:54 am »
If you're linking statically, you should be linking the static libraries but not the dynamic ones. That is, the DLLs should not be linked. The fact that it's looking for them means you've told it to look for them.

Have you tried linking dynamically first? Did that work?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*