Jump to content
  • Advertisement
Sign in to follow this  
noatom

unresolved external symbol

This topic is 2076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a function in a class declared with __declspec(dllexport) .

The function is also defined.

 

But when called in a cpp file,i get unresolved external symbol....

Share this post


Link to post
Share on other sites
Advertisement

Didn't you have the same problem the other week?

 

My advice is the same: post the prototype and the error (EDIT: and the line where you call the function, as well as the declarations for any arguments).

 

My guesses before were:

 

Unicode/non-Unicode mismatch between DLL and EXE, or

You made a typo when calling the function

Edited by Paradigm Shifter

Share this post


Link to post
Share on other sites

I do not use it in any exe, the error appears in the dll itself.

There is no typo...i'm pretty sure visual studio would've warned me about that,or I would've seen it.

 error LNK2019: unresolved external symbol "public: struct _VOLUME_INFO const & __thiscall CPlayer::GetVolumeInfo(void)const " (?GetVolumeInfo@CPlayer@@QBEABU_VOLUME_INFO@@XZ) referenced in function "public: static void __cdecl Devil_Room::Terrain::UpdatePlayer(void *,class CPlayer *,float)" (?UpdatePlayer@Terrain@Devil_Room@@SAXPAXPAVCPlayer@@M@Z) 

__declspec(dllexport) const VOLUME_INFO& GetVolumeInfo ( ) const; 

 

Calling code:

VOLUME_INFO Volume = pPlayer->GetVolumeInfo(); 

Share this post


Link to post
Share on other sites

Hmm dunno. Does it compile if you call it from a function defined inside the class declaration? (Just add a dummy function that calls it, you'll need to include the definition of CPlayer though to do that inside the class).

 

Off to get some beer anyway, I'll check back later on.

Share this post


Link to post
Share on other sites

Well are you including the header with the declspec in the cpp file which calls it?

 

VOLUME_INFO isn't declared inside the class is it (because you need to scope it outside the class then i.e. CPlayer::VOLUME_INFO)?

Share this post


Link to post
Share on other sites

So you have __dllexport both on the class and the member function?

 

MSDN says this:

Note that explicit use of the dllimport and dllexport attributes on members of an exportable class is prohibited.

so try and remove it.

Share this post


Link to post
Share on other sites

Solved... the function i was calling was calling another function with the exact same name,but for a different class,which was obviously undefined...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!