Old "statndard C++" in VC++ Express  
Author Message
rowck001





PostPosted: Visual C++ Express Edition, Old "statndard C++" in VC++ Express Top

This may sound silly - but I have successfully built CLR .NET Apps and with the Platform SDK some win32 native apps using VC++ express 2005 with ease! .

But how can I use some old C++ code of form:

#include <iostream>
using namespace std;

int main(){
cout << "whatever xxx......" << endl;
return 0;
}

making an empty project and adding file(s) containing straight C++ code like the above, results in 48++ link errors.
Obviously I am missing something basic here!


Visual Studio Express Editions8  
 
 
nobugz





PostPosted: Visual C++ Express Edition, Old "statndard C++" in VC++ Express Top

It would help if you post the linker errors.


 
 
rowck001





PostPosted: Visual C++ Express Edition, Old "statndard C++" in VC++ Express Top

------ Build started: Project: stdclibs, Configuration: Release Win32 ------
Linking...
test1.obj : error LNK2019: unresolved external symbol "public: __thiscall std::exception::exception(char const * const &)" ( 0exception@std@@QAE@ABQBD@Z) referenced in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" ( 0bad_alloc@std@@QAE@PBD@Z)
test1.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" ( _7type_info@@6B@)
test1.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " ( what@exception@std@@UBEPBDXZ)
test1.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall std::exception::~exception(void)" ( 1exception@std@@UAE@XZ) referenced in function "public: virtual __thiscall std::bad_alloc::~bad_alloc(void)" ( 1bad_alloc@std@@UAE@XZ)
test1.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" ( 3@YAXPAX@Z) referenced in function "public: virtual void * __thiscall std::bad_alloc::`scalar deleting destructor'(unsigned int)" ( _Gbad_alloc@std@@UAEPAXI@Z)
test1.obj : error LNK2019: unresolved external symbol _memcpy_s referenced in function "public: static char * __cdecl std::char_traits<char>::_Copy_s(char *,unsigned int,char const *,unsigned int)" ( _Copy_s@ $char_traits@D@std@@SAPADPADIPBDI@Z)
test1.obj : error LNK2019: unresolved external symbol _memmove_s referenced in function "public: static char * __cdecl std::char_traits<char>::_Move_s(char *,unsigned int,char const *,unsigned int)" ( _Move_s@ $char_traits@D@std@@SAPADPADIPBDI@Z)
test1.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_Mutex::_Unlock(void)" ( _Unlock@_Mutex@std@@QAEXXZ) referenced in function "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" ( _Unlock@ $basic_streambuf@DU $char_traits@D@std@@@std@@QAEXXZ)
test1.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_Mutex::_Lock(void)" ( _Lock@_Mutex@std@@QAEXXZ) referenced in function "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" ( _Lock@ $basic_streambuf@DU $char_traits@D@std@@@std@@QAEXXZ)
test1.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new(unsigned int)" ( 2@YAPAXI@Z) referenced in function "char * __cdecl std::_Allocate<char>(unsigned int,char *)" ( $_Allocate@D@std@@YAPADIPAD@Z)
test1.obj : error LNK2019: unresolved external symbol __CxxThrowException@8 referenced in function "char * __cdecl std::_Allocate<char>(unsigned int,char *)" ( $_Allocate@D@std@@YAPADIPAD@Z)
test1.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" ( 0exception@std@@QAE@ABV01@@Z)
test1.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" ( _Xran@_String_base@std@@SAXXZ) 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> >::erase(unsigned int,unsigned int)" ( erase@ $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@QAEAAV12@II@Z)
test1.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "protected: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Copy(unsigned int,unsigned int)" ( _Copy@ $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@IAEXII@Z)
test1.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$ _Copy@ $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@IAEXII@Z
test1.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function __ehhandler$ _Copy@ $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@IAEXII@Z
test1.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" ( _Xlen@_String_base@std@@SAXXZ) referenced in function "protected: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" ( _Grow@ $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@IAE_NI_N@Z)
test1.obj : error LNK2019: unresolved external symbol "public: __thiscall std::exception::exception(void)" ( 0exception@std@@QAE@XZ) referenced in function "public: __thiscall std::runtime_error::runtime_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ( 0runtime_error@std@@QAE@ABV $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@1@@Z)
test1.obj : error LNK2019: unresolved external symbol "bool __cdecl std::uncaught_exception(void)" ( uncaught_exception@std@@YA_NXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" ( 1sentry@ $basic_ostream@DU $char_traits@D@std@@@std@@QAE@XZ)
test1.obj : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > std::cout" ( cout@std@@3V $basic_ostream@DU $char_traits@D@std@@@1@A) referenced in function _main
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
LINK : error LNK2001: unresolved external symbol __load_config_used
C:\Documents and Settings\Craig Rowlands\My Documents\Visual Studio 2005\Projects\stdclibs\Release\stdclibs.exe : fatal error LNK1120: 22 unresolved externals


 
 
nobugz





PostPosted: Visual C++ Express Edition, Old "statndard C++" in VC++ Express Top

You're not linking the STL runtime library (msvcprt.lib or libcpmt.lib in the Release build). I'm not sure how you did that...


 
 
lomo74





PostPosted: Visual C++ Express Edition, Old "statndard C++" in VC++ Express Top

Sorry if I re-open this topic, but I have similar problems and I was wondering if someone can help.
I have platform SDK's include and lib directories on top of VC++ 2005 Express search paths.
Platform SDK is Server 2003 R2.
Well, the linker complains about symbols missing:

error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<char,struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (__imp_ $ 6DU $char_traits@D@std@@@std@@YAAAV $basic_ostream@DU $char_traits@D@std@@@0@AAV10@PBD@Z)

The code is straightforward, simply a cout << "hello world";.
I'm *sure* the problem is that libcpmt.lib is missing from Platform SDK: thus, the compiler is using SDK's header files, but the linker is linking against older .lib files, hence the error.
Am I wrong
Someone knows why Microsoft did not include libcpmt.lib in Platform SDK
Where can I find it