SFML community forums

Help => Graphics => Topic started by: lorence30 on May 24, 2015, 07:06:13 pm

Title: undefine reference
Post by: lorence30 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.
Title: Re: undefine reference
Post by: eXpl0it3r on May 24, 2015, 07:20:04 pm
Because you linked something wrong.
Title: Re: undefine reference
Post by: lorence30 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
 
Title: Re: undefine reference
Post by: shadowmouse 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?
Title: Re: undefine reference
Post by: lorence30 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
Title: Re: undefine reference
Post by: texus 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.
Title: Re: undefine reference
Post by: lorence30 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 :(
Title: Re: undefine reference
Post by: shadowmouse 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?
Title: Re: undefine reference
Post by: lorence30 on May 24, 2015, 08:42:51 pm
is this the best release? http://www.sfml-dev.org/download/sfml/2.3/ or nightly?
Title: Re: undefine reference
Post by: shadowmouse 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.
Title: Re: undefine reference
Post by: lorence30 on May 24, 2015, 08:53:31 pm
is mingw okay?  TDM (SJLJ) - 32-bit is what im using in 2.1
Title: Re: undefine reference
Post by: shadowmouse 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.
Title: Re: undefine reference
Post by: lorence30 on May 24, 2015, 09:05:06 pm
okay Ill tell you when its done
(i use TDM because it says on the tutorial)
Title: Re: undefine reference
Post by: G. 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 )
Title: Re: undefine reference
Post by: lorence30 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
Title: Re: undefine reference
Post by: G. on May 25, 2015, 05:06:46 pm
It's very hard, but you have to use the version of SFML compiled for the compiler you use...
From what I can read on the CB download page (http://www.codeblocks.org/downloads/26) , if you use the compiler package with codeblocks it's either the TDM 4.7.1 or  TDM 4.8.1...
Is there a reason why you're trying to use 4.9.2?
Title: Re: undefine reference
Post by: shadowmouse on May 25, 2015, 05:16:22 pm
That's because I recommended it because binary recommended it for me as the best version as it is more stable and reliable than 4.8.1 and has c++11 which is good as 4.7.1 doesn't.
Title: Re: undefine reference
Post by: G. on May 25, 2015, 05:45:20 pm
But it has to match your compiler version. :p
Title: Re: undefine reference
Post by: shadowmouse on May 25, 2015, 05:50:06 pm
Yes, so you download the 4.9.2 version of sfml 2.3 and the compilerless version of codeblocks.