2 Replies - 4798 Views - Last Post: 29 January 2012 - 03:07 AM

#1 Mennovf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-October 11

Error LNK2028 and 2019 using vector

Posted 28 January 2012 - 03:28 PM

Hi,
I am using an std::vector (#include <vector>) in a managed class by using pointers. Altough other native classes work using pointers, I now get linking errors, but they make it too hard to see what the problem is.
These are the errors:

error LNK2028: unresolved token (0A0000F7) "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ) referenced in function "public: unsigned short & __thiscall std::vector<unsigned short,class std::allocator<unsigned short> >::operator[](unsigned int)" (??A?$vector@GV?$allocator@G@std@@@std@@$$FQAEAAGI@Z)

error LNK2019: unresolved external symbol "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ) referenced in function "public: unsigned short & __thiscall std::vector<unsigned short,class std::allocator<unsigned short> >::operator[](unsigned int)" (??A?$vector@GV?$allocator@G@std@@@std@@$$FQAEAAGI@Z)

They both happen in the same object, probably caused by the same problem.
I hope someone has an answer for this as google didn't provide any.
If you need any additional information, just ask.
Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Error LNK2028 and 2019 using vector

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 4293
  • View blog
  • Posts: 13,462
  • Joined: 25-December 09

Re: Error LNK2028 and 2019 using vector

Posted 28 January 2012 - 05:48 PM

It seems that the first error: LNK2028 is being caused by trying to use a std::C++ in mangled C++. Trying to mix Microsoft mangled code with standard C/C++ can cause problems. If you are using mangled code I suggest that you try to avoid using standard C++ containers. Try to find a mangled solution. Like maybe the STL/CLR vector class.


Jim

This post has been edited by jimblumberg: 28 January 2012 - 05:48 PM

Was This Post Helpful? 0
  • +
  • -

#3 Mennovf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-October 11

Re: Error LNK2028 and 2019 using vector

Posted 29 January 2012 - 03:07 AM

Thanks for replying.
Your answer worked, I replaced the std::vector's with cliext::vector's.
Although this made yet another error: LNK2022.
This had something to do with a template class not being used in the header file.
This solved it: http://social.msdn.m...9e-4c3a1d7cd5d4
Thanks for the suggestion
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1