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

Author Topic: Code::Blocks: Unable to compile with SFML 2.5.1  (Read 1151 times)

0 Members and 1 Guest are viewing this topic.

tsalop

  • Newbie
  • *
  • Posts: 3
    • View Profile
Code::Blocks: Unable to compile with SFML 2.5.1
« on: February 10, 2020, 07:01:19 pm »
I have a project that was made with SFML 2.2 and it works fine... However when I try to upgrade it to SFML 2.5.1 compiling the code results to the following error:

Quote
||=== Build: Release in Rogue (compiler: GNU GCC Compiler) ===|
obj\rge_main.o:rge_main.cpp|| undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKSsRKNS_4RectIiEE'|
obj\rge_main.o:rge_main.cpp|| undefined reference to `_imp___ZN2sf5Image12loadFromFileERKSs'|
||error: ld returned 1 exit status|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Switching back to SFML 2.2 makes the error go away...

tsalop

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Code::Blocks: Unable to compile with SFML 2.5.1
« Reply #1 on: February 10, 2020, 07:06:39 pm »
Update!
Downloading the SFML 2.5.1 libraries fixed the problem but now I am getting a lot of different errors from the key input that I did not have when compiling the code with SFML 2.2... I added the file in question as attachment if somebody wants to take a look.

Quote
||=== Build: Release in Rogue (compiler: GNU GCC Compiler) ===|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp||In function 'void releaseKeys(sf::Event)':|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|32|error: 'event' has incomplete type|
D:\SFML-2.5.1\include\SFML\Window.hpp|52|error: forward declaration of 'class sf::Event'|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|33|error: incomplete type 'sf::Event' used in nested name specifier|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|34|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|35|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|36|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|37|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|38|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|39|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|40|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|41|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|42|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp||In function 'void getMenuKeys()':|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|58|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|58|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|59|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|59|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|60|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|60|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|61|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|61|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|63|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|63|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|64|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|64|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|66|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|66|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|67|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|67|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|69|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|69|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp||In function 'void handleEvents(sf::Event)':|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|99|error: 'event' has incomplete type|
D:\SFML-2.5.1\include\SFML\Window.hpp|52|error: forward declaration of 'class sf::Event'|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|101|error: incomplete type 'sf::Event' used in nested name specifier|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|101|error: incomplete type 'sf::Event' used in nested name specifier|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|101|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|107|error: incomplete type 'sf::Event' used in nested name specifier|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|107|error: 'Keyboard' has not been declared|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp||In function 'void getEvents()':|
D:\Old Files\CodeBlocks\HorrorRoque\rpg_input.cpp|118|error: aggregate 'sf::Event event' has incomplete type and cannot be defined|
||=== Build failed: 38 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

tsalop

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Code::Blocks: Unable to compile with SFML 2.5.1
« Reply #2 on: February 10, 2020, 07:23:31 pm »
Update 2!
Adding following line to the code seemed to fix the said problems.
Quote
#include <SFML/Window/Event.hpp>
This doesn't really make sense as in the imported header file I have already imported SFML/Window

Also now I get even more problems:
Quote
||=== Build: Release in Rogue (compiler: GNU GCC Compiler) ===|
obj\rge_main.o:rge_main.cpp|| undefined reference to `sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'|
obj\rge_main.o:rge_main.cpp|| undefined reference to `sf::Image::loadFromFile(std::string const&)'|
||error: ld returned 1 exit status|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

However trying to import the Texture.hpp doesn't need to solve that (and would be weird if it would).

 

anything