STL in vs2005 problem

Just create a non-MFC dll projcet, add these lines

#include <string>
using namespace std;

in .cpp file cause these complier error

Compiling...
reindeer.cpp
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(94) : warning C4346: '_It::iterator_category' : dependent name is not a type
        prefix with 'typename' to indicate a type
        D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(97) : see reference to class template instantiation 'std::iterator_traits<_It>' being compiled
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(94) : error C2146: syntax error : missing ';' before identifier 'iterator_category'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(94) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(95) : warning C4346: '_It::value_type' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(95) : error C2146: syntax error : missing ';' before identifier 'value_type'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(95) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(96) : warning C4346: '_It::distance_type' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(96) : error C2146: syntax error : missing ';' before identifier 'distance_type'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\utility(96) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(224) : warning C4346: '_A::size_type' : dependent name is not a type
        prefix with 'typename' to indicate a type
        D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(796) : see reference to class template instantiation 'std::basic_string<_E,_Tr,_A>' being compiled
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(224) : error C2146: syntax error : missing ';' before identifier 'size_type'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(224) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(225) : warning C4346: '_A::difference_type' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(225) : error C2146: syntax error : missing ';' before identifier 'difference_type'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(225) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(226) : warning C4346: '_A::pointer' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(226) : error C2146: syntax error : missing ';' before identifier 'pointer'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(226) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(227) : warning C4346: '_A::const_pointer' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(227) : error C2146: syntax error : missing ';' before identifier 'const_pointer'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(227) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(228) : warning C4346: '_A::reference' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(228) : error C2146: syntax error : missing ';' before identifier 'reference'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(228) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(229) : warning C4346: '_A::const_reference' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(229) : error C2146: syntax error : missing ';' before identifier 'const_reference'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(229) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(230) : warning C4346: '_A::value_type' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(230) : error C2146: syntax error : missing ';' before identifier 'value_type'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(230) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(231) : warning C4346: '_A::pointer' : dependent name is not a type
        prefix with 'typename' to indicate a type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(231) : error C2144: syntax error : 'std::iterator' should be preceded by ';'
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(231) : error C2208: 'std::iterator' : no members defined using this type
D:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Include\xstring(231) : fatal error C1903: unable to recover from previous error(s); stopping compilation




Answer this question

STL in vs2005 problem

  • Prasenna

    I tried creating a simple Windows console application and a simple windows DLL, both for device.

    Then I put

    #include <string>
    using namespace std;

    in the code and it compiled without any error.

    Can you please elaborate where is the problem occuring



  • Zadoras

    My application is not a Windows console but a Windows CE 4.2 application using PocketPC 2003 SDK include and lib files.
  • silentC

    Hi,

    I am facing the same problem. 'nunch' did you resolve the problem and if so how

    Thanks

    Arpit Mehta
    Graduate Student
    Columbia University, NY

  • lmttag

    I am able to create a PPC targetted Smart device dll project and include the said headers and compile. No issues found

    Thanks

    Srikant Bogadapati



  • sheidee21

    Hello, I have the same problem. After a search in some other forums, the problem could come from the header file which is written with an "old" C++ syntax. It can compile with eVC++ 4 but not with the VS 2005 compiler which is stricter.

    Now I (temporarily) solved the problem by changing the include directory. In Tools -> Options -> Projects & Solutions -> VC++ directories, I had the following order:

    - $(VSInstallDir)SmartDevices\SDK\PocketPC2003\include

    - $(VCInstallDir)ce\include

    And I set this order:

    - $(VCInstallDir)ce\include

    - $(VSInstallDir)SmartDevices\SDK\PocketPC2003\include

    It seems the files in $(VCInstallDir)ce\include are for Windows Mobile 5.0 and more recent with a better C++ syntax.

    I hope it can help you and maybe MS people could assert what I wrote or propose a better solution.


  • STL in vs2005 problem