CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Simple Program

  1. #1
    Join Date
    Sep 2009
    Posts
    27

    Simple Program

    I made this program to duplicate an error I'm receiving. When I run the program I receive:

    Code:
    Snake.obj : error LNK2019: unresolved external symbol
     __imp___CrtDbgReportW referenced in function "public: __thiscall 
    std::_Vector_const_iterator<short,class std::allocator<short> 
    >::_Vector_const_iterator<short,class std::allocator<short> >(short *,class 
    std::_Container_base_secure const *)" 
    (??0?$_Vector_const_iterator@FV?$allocator@F@std@@@std@@QAE@PAFPBV_Container_base_secure@1@@Z)
    I've looked up information about LNK2019 and LNK2001 in multiple forums, on MSVC, and other websites, but the information didn't really seem to apply.

    Code:
    #pragma comment(lib, "SDL.lib")
    #pragma comment(lib, "SDLmain.lib")
    #pragma comment(lib, "SDL_TTF.lib")
    #pragma comment(lib, "SDL_image.lib")
    
    #include <vector>
    #include <string>
    #include "SDL.h"
    #include "SDL_TTF.h"
    #include "SDL_image.h"
    
    using namespace std;
    
    class Test {
      public:
        Test();
    
      private:
        vector<vector<short>> myvar;
    };
    
    Test::Test()
    : myvar ()
    {
      //Uncommenting these two lines, 
      //it will report LNK2001 instead of LNK2019
    
      //vector<short> test (2, 10);
      //this->myvar.push_back(test);
    
      myvar.resize(1);
    }
    
    SDL_Event testevent;
    
    int main( int argc, char* args[] ) {
      bool genericloop = true;
    
      while( genericloop ) {
        SDL_PollEvent( &testevent );
        if ( testevent.type == SDL_QUIT ) genericloop = false;
      }
      return 0;
    }
    Does anyone have any ideas? Thanks!
    -Aaron

  2. #2
    Join Date
    Mar 2002
    Location
    Kent, United Kingdom
    Posts
    399

    Re: Simple Program

    Code:
    private:
        vector<vector<short> > myvar;
    Not sure if this is the problem, but you need to make sure this is > > ( space between > and > ) and not >>.
    your humble savant

  3. #3
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Simple Program

    Quote Originally Posted by TheRogue
    Not sure if this is the problem, but you need to make sure this is > > ( space between > and > ) and not >>.
    That would have resulted in a compile error though, but since it is a linker error it implies that KezRst is using a compiler that has incorporated that bit of the next version of C++ into the syntax that it accepts.

    I think the key here is __imp___CrtDbgReportW. A quick search brings up unresolved external symbol __imp___CrtDbgReportW.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  4. #4
    Join Date
    Sep 2009
    Posts
    27

    Re: Simple Program

    Quote Originally Posted by TheRogue View Post
    Code:
    private:
        vector<vector<short> > myvar;
    Not sure if this is the problem, but you need to make sure this is > > ( space between > and > ) and not >>.
    Oops, that's just a typo. I have double checked to make sure that the spacing of the array is correct. I also boiled it down to a single dimensional array at one point, and still got the same error.

  5. #5
    Join Date
    Sep 2009
    Posts
    27

    Re: Simple Program

    Quote Originally Posted by laserlight View Post
    That would have resulted in a compile error though, but since it is a linker error it implies that KezRst is using a compiler that has incorporated that bit of the next version of C++ into the syntax that it accepts.

    I think the key here is __imp___CrtDbgReportW. A quick search brings up unresolved external symbol __imp___CrtDbgReportW.
    Thank you! I would not have thought to look up that particular part of the error message, since so much of it looked like Greek to me.
    Scrolling down a few posts I found someone who had the exact same error as me, and how to fix it.

    When I removed '_DEBUG' from my pre-processor definitions, it resolved my link error.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured