LNK2019 with .net 2003 and standard c++ library

This is a discussion on LNK2019 with .net 2003 and standard c++ library within the C++ Programming forums, part of the General Programming Boards category; when using cin, i get a linker error when compiling with the release libraries, but it compiles fine with the ...

  1. #1
    Counter-Strike Master
    Join Date
    Dec 2002
    Posts
    38

    Question LNK2019 with .net 2003 and standard c++ library

    when using cin, i get a linker error when compiling with the release libraries, but it compiles fine with the debug libraries. all project settings are at default. here is the test code that i used:

    Code:
    #include <iostream>    //new standard c++ header
    #include <cstdio>
    #include <cstdlib>    //random header
    #include <ctime>    //random header
    
    //using namespace std;
    
    int temp;
    
    int main()
    {
    	std::cout << "Testing.\n";
    	printf("Testing printf.\n");
    	std::cin >> temp;	//link error
    	return 0;
    }
    and here are the errors that i get:
    Code:
    test_ndebug.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::locale::facet::_Register(void)" (?_Register@facet@locale@std@@QAEXXZ) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)
    test_ndebug.obj : error LNK2019: unresolved external symbol "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)
    test_ndebug.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::append(unsigned int,char)" (?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ID@Z)
    test_ndebug.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::append(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)
    You say "Impressive!", but I already know it
    I'm a hardcore player and I'm not afraid to show it

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    maybe the compiler doesn't like you using cout and printf() in the same program???

  3. #3
    Counter-Strike Master
    Join Date
    Dec 2002
    Posts
    38
    nope, i've already determined that cin is causing the error. try to comment it out and see for yourself. this is a problem that had in a larger program which im hoping to get fixed
    You say "Impressive!", but I already know it
    I'm a hardcore player and I'm not afraid to show it

  4. #4
    Counter-Strike Master
    Join Date
    Dec 2002
    Posts
    38
    [bump]

    id really like some help on this, seeing as the standard c++ library is extremely important, and that i wont be able to compile anything until i fix this problem
    You say "Impressive!", but I already know it
    I'm a hardcore player and I'm not afraid to show it

  5. #5
    Counter-Strike Master
    Join Date
    Dec 2002
    Posts
    38
    [bump and update]

    i made a new program to test and i compiled it with only a cout statement. it compiled successfully, but the program crashed when i tried to run it. as i said, its only compiling properly with the debug libraries, not the release ones. what is the problem?
    You say "Impressive!", but I already know it
    I'm a hardcore player and I'm not afraid to show it

  6. #6
    Counter-Strike Master
    Join Date
    Dec 2002
    Posts
    38
    [bump]
    You say "Impressive!", but I already know it
    I'm a hardcore player and I'm not afraid to show it

  7. #7
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Post the code of the new program please.

  8. #8
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,551
    > [bump]
    Read rule 5
    http://cboard.cprogramming.com/annou...ouncementid=51

    Come back when you understand it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. edit and continue VC++ Net 2003 Standard.
    By Bajanine in forum Windows Programming
    Replies: 5
    Last Post: 08-11-2004, 03:07 PM
  2. VS .NET 2003 Is Bloat!
    By UnregdRegd in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 02-29-2004, 09:51 PM
  3. Visual C++ .NET Standard Edition
    By knave in forum C++ Programming
    Replies: 1
    Last Post: 07-24-2003, 09:19 PM
  4. VC++ .net 2003.....
    By iwod in forum Windows Programming
    Replies: 32
    Last Post: 07-13-2003, 11:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21