std::string link error

All questions regarding Windows programming, post here. API,COM, ActiveX, DirectX, OpenGL, MFC and so on...

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

std::string link error

Postby ankireddy26 » Thu Jan 07, 2010 5:43 am

Hi,

i am using VC6 with STL port and ImageMagick (Another library for Image processing).

I configured everything with STLPort and when i run i am getting the following error.

inking...
With50View.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::read(class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > const &)" (__imp_?read@Image@Magi
ck@@QAEXABV?$basic_string@DV?$char_traits@D@_STL@@V?$allocator@D@2@@_STL@@@Z)
Release/With50.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

( i uncommented _STLP_NO_OWN_IOSTREAMS in stl_user_config.h file)

I think the error is because, the image read function required std::string as input but in this case it is looking with STLPort::string.

Can anyone help me how to solve this?

Thanks in advance
ankdireddy
ankireddy26
 
Posts: 1
Joined: Thu Jan 07, 2010 5:41 am

Re: std::string link error

Postby Alvaro » Thu Jan 07, 2010 10:29 am

ankireddy26 wrote:i am using VC6 [...]

Why?
User avatar
Alvaro
Moderator
 
Posts: 5185
Joined: Mon Sep 22, 2003 4:57 pm
Location: NY, USA

Re: std::string link error

Postby chrisadam » Sun Sep 05, 2010 11:14 pm

You're mixing object files compiled with VS 2008 and VS 2010. This is forbidden when using the C++ Standard Library. (Unfortunately, we can't emit a nice linker error in this scenario, although we will when mixing 2010 and post-2010.)

The symptom is the linker error complaining about std::basic_string and __declspec(dllimport). In VS 2010, std::basic_string isn't marked __declspec(dllimport) anymore. Therefore, if the linker is complaining like this, you're picking up VS 2008's headers somehow (whether in this compilation, or with a separately compiled object file). You can compile with /showIncludes to see what headers are getting dragged in. Since Acquisition_Imaging.obj is looking for __declspec(dllimport) std::basic_string, it's almost certainly one of the offending object files.
chrisadam
 
Posts: 2
Joined: Sun Sep 05, 2010 11:03 pm

Re: std::string link error

Postby jennyfer99 » Fri Sep 02, 2011 5:24 am

thank for explanation chrisadam, information you've provided cleared everything
jennyfer99
 
Posts: 4
Joined: Fri Sep 02, 2011 5:19 am


Return to Windows Programming

Who is online

Users browsing this forum: No registered users and 2 guests