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

Author Topic: undefine reference  (Read 6018 times)

0 Members and 1 Guest are viewing this topic.

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
undefine reference
« on: May 24, 2015, 07:06:13 pm »
undefined reference to `_imp___ZN2sf5ImageD1Ev'|

why i keep getting this error? i cant start my program.
im using C::B 13.12, SFML 2.1

but i can use the other classes in graphics like texture and sprites fine.
« Last Edit: May 24, 2015, 07:18:46 pm by lorence30 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: undefine reference
« Reply #1 on: May 24, 2015, 07:20:04 pm »
Because you linked something wrong.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: undefine reference
« Reply #2 on: May 24, 2015, 07:29:07 pm »
sfml-graphics
sfml-window
sfml-system
this is what im linking

and SFML_STATIC for static linking.

i dont know what to do now, i have read many threads but didnt help
 

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: undefine reference
« Reply #3 on: May 24, 2015, 08:00:46 pm »
Have you added the -s to all sfml libraries and -d if they're in debug mode? Also, have you linked all of sfml's dependencies?

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: undefine reference
« Reply #4 on: May 24, 2015, 08:14:29 pm »
@shadowmouse

i tried all, like i said i can use sf::Texture and sf::Sprite fine.
but it spit out that error because of the sf::Image

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: undefine reference
« Reply #5 on: May 24, 2015, 08:27:22 pm »
The sf::Image destructor was added after SFML 2.1.
So you are most likely including a header file from a newer sfml version while still linking to the older libraries.
TGUI: C++ SFML GUI

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: undefine reference
« Reply #6 on: May 24, 2015, 08:32:55 pm »
[qoute]The sf::Image destructor was added after SFML 2.1.
So you are most likely including a header file from a newer sfml version while still linking to the older libraries.[/qoute]

Im using 2.2's header file and linking with 2.1

i cant get 2.2's dll to work :(

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: undefine reference
« Reply #7 on: May 24, 2015, 08:38:03 pm »
Why not just use 2.3 rather than trying to mix and match libraries and headers from different versions which is bound to go wrong?

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: undefine reference
« Reply #8 on: May 24, 2015, 08:42:51 pm »
is this the best release? http://www.sfml-dev.org/download/sfml/2.3/ or nightly?

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: undefine reference
« Reply #9 on: May 24, 2015, 08:46:15 pm »
Just get MinGW 4.9.2 (it's the best version) and use the one from the link you provided.

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: undefine reference
« Reply #10 on: May 24, 2015, 08:53:31 pm »
is mingw okay?  TDM (SJLJ) - 32-bit is what im using in 2.1

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: undefine reference
« Reply #11 on: May 24, 2015, 08:58:02 pm »
TDM is notorious, which is why I said use the latest version of MinGW, which is 4.9.2.

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: undefine reference
« Reply #12 on: May 24, 2015, 09:05:06 pm »
okay Ill tell you when its done
(i use TDM because it says on the tutorial)

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: undefine reference
« Reply #13 on: May 24, 2015, 10:09:59 pm »
sfml-graphics
sfml-window
sfml-system
this is what im linking

and SFML_STATIC for static linking.

i dont know what to do now, i have read many threads but didnt help
The tutorial also says that when static linking you need to link to -s version of the library (sfml-graphics-s etc.) and to several other dependencies. (freetype, etc.) if you're using SFML > 2.1
Don't try to mix 2.1 and 2.2, that's crazy.
Download and use the version compatible with your compiler. If you say that you previously used "GCC 4.7 TDM (SJLJ) - 32-bit" with 2.1, I'd try "GCC 4.7.1 TDM (SJLJ) - 32-bit" for 2.3. (Or better, check what your compiler is and use the same version or compile SFML yourself. :p )

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: undefine reference
« Reply #14 on: May 25, 2015, 02:44:44 pm »
I cant get mingW 4.9.2 to work

i keep getting this error
http://puu.sh/hZNZe/f7a23a5f0e.png

 

anything