Thread: Erros in Utility Header File

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    167

    Erros in Utility Header File

    I'm using vc++ Introductory Edition. I also have the commandline version of vc++.net that comes with the .net sdk. The vc++.net compiler compiles c code fine but not the c++ code because it doesn't have the STL i think someone said. So I had an idea. I copied the vc++.net compiler (cl.exe and other dlls) to the vc6 bin directory. I don't have problems compiling c code but I am still having problems with c++ code. A simple c++ program that includes iostream gives me these errors.

    Code:
     
    --------------------Configuration: perfect_numbers - Win32 Release--------------------
    Compiling...
    cl : Command line warning D4029 : optimization is not available in the standard edition compiler
    perfect_num.cpp
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(81) : warning C4346: '_It::iterator_category' : dependent name is not a type
            prefix with 'typename' to indicate a type
            C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(84) : see reference to class template instantiation 'std::iterator_traits<_It>' being compiled
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(81) : error C2146: syntax error : missing ';' before identifier 'iterator_category'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(81) : error C2501: 'std::iterator_traits<_It>::iterator_category' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(82) : warning C4346: '_It::value_type' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(82) : error C2146: syntax error : missing ';' before identifier 'value_type'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(82) : error C2501: 'std::iterator_traits<_It>::value_type' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(83) : warning C4346: '_It::distance_type' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(83) : error C2146: syntax error : missing ';' before identifier 'distance_type'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(83) : error C2501: 'std::iterator_traits<_It>::distance_type' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(224) : warning C4348: 'std::istreambuf_iterator' : redefinition of default parameter : parameter 2
            C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(279) : see declaration of 'std::istreambuf_iterator'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(226) : warning C4346: '_Tr::off_type' : dependent name is not a type
            prefix with 'typename' to indicate a type
            C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(279) : see reference to class template instantiation 'std::istreambuf_iterator<_E,_Tr>' being compiled
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(226) : error C2923: 'std::iterator' : '_Tr::off_type' is invalid as template argument '#3', type expected
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(231) : warning C4346: '_Tr::int_type' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(231) : error C2146: syntax error : missing ';' before identifier 'int_type'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(231) : error C2501: 'std::istreambuf_iterator<_E,_Tr>::int_type' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(289) : warning C4348: 'std::ostreambuf_iterator' : redefinition of default parameter : parameter 2
            C:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(318) : see declaration of 'std::ostreambuf_iterator'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(25) : warning C4346: '_A::size_type' : dependent name is not a type
            prefix with 'typename' to indicate a type
            C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(597) : see reference to class template instantiation 'std::basic_string<_E,_Tr,_A>' being compiled
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(25) : error C2146: syntax error : missing ';' before identifier 'size_type'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(25) : error C2501: 'std::basic_string<_E,_Tr,_A>::size_type' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(26) : warning C4346: '_A::difference_type' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(26) : error C2146: syntax error : missing ';' before identifier 'difference_type'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(26) : error C2501: 'std::basic_string<_E,_Tr,_A>::difference_type' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(27) : warning C4346: '_A::pointer' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(27) : error C2146: syntax error : missing ';' before identifier 'pointer'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(27) : error C2501: 'std::basic_string<_E,_Tr,_A>::pointer' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(28) : warning C4346: '_A::const_pointer' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(28) : error C2146: syntax error : missing ';' before identifier 'const_pointer'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(28) : error C2501: 'std::basic_string<_E,_Tr,_A>::const_pointer' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(29) : warning C4346: '_A::reference' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(29) : error C2146: syntax error : missing ';' before identifier 'reference'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(29) : error C2501: 'std::basic_string<_E,_Tr,_A>::reference' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(30) : warning C4346: '_A::const_reference' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(30) : error C2146: syntax error : missing ';' before identifier 'const_reference'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(30) : error C2501: 'std::basic_string<_E,_Tr,_A>::const_reference' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(31) : warning C4346: '_A::value_type' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(31) : error C2146: syntax error : missing ';' before identifier 'value_type'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(31) : error C2501: 'std::basic_string<_E,_Tr,_A>::value_type' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(32) : warning C4346: '_A::pointer' : dependent name is not a type
            prefix with 'typename' to indicate a type
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(32) : error C2144: syntax error : 'std::iterator' should be preceded by ';'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(32) : error C2698: the using-declaration for 'pointer' cannot co-exist with the existing using-declaration for 'pointer'
    C:\Program Files\Microsoft Visual Studio\VC98\Include\XSTRING(32) : fatal error C1903: unable to recover from previous error(s); stopping compilation
    Error executing cl.exe.
    
    perfect_numbers.exe - 26 error(s), 16 warning(s)
    Can any c++ gurus help me with this?
    silk.odyssey

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > I copied the vc++.net compiler (cl.exe and other dlls) to the vc6 bin directory
    I think that pretty much sums up the problem

    VC++ 6 compatibility with the standard was crap compared to vc++.net - its no wonder its barfing on all those header files.

    The rule about not copying header files from one compiler to another even applies to different versions of the same compiler.

    You've also killed your previous vc++ 6 installation as well.

    If you want a decent c++ compiler with STL, then I'd suggest you look at dev-c++
    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.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    In other words, the old headers from VC++6 are written so that the (bad) VC++6 compiler can compile them.
    The new VC++7.1 compiler however cannot because it can only compile code that follows the C++ standard.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    Thanks for the replies. Is there an sdk or something that has the stl for vc7? Why ms can't give us the stl?
    silk.odyssey

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Because you're supposed to BUY the compiler
    And because the C++ compiler provided with the .Net SDK is only meant to compile Managed C++ bridges.

    You can download STLport, it's a free STL implementation and should work with VC++7.1
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding Header Files
    By Kaidao in forum C++ Programming
    Replies: 11
    Last Post: 03-25-2008, 10:02 AM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Replies: 6
    Last Post: 04-02-2002, 05:46 AM