What happened to vector?

Something is wrong with the STL 'vector' header file in the 2005 Express installation.  After installing beta 2, I can't compile any source files which #include<vector> any more.  The vector file is now 59k as opposed to a very tiny 'vector' header in the VC++ 2003 Toolkit.  Also, the VC++2005 vector file has all the code in it, while the vector file that works only has a few lines including some other headers.  These problems just started with Beta 2.  I get about nine syntax errors  pointing me to various lines in vc++2005 'vector':

------ Build started: Project: test, Configuration: Debug Win32 ------

Compiling...

test.cpp

c:\program files\microsoft visual studio 8\vc\include\vector(449) : error C2143: syntax error : missing ')' before '&'

c:\program files\microsoft visual studio 8\vc\include\vector(447) : see reference to class template instantiation 'std::vector<_Ty,_Alloc>::_Checked_array_allocator' being compiled

c:\program files\microsoft visual studio 8\vc\include\vector(1262) : see reference to class template instantiation 'std::vector<_Ty,_Alloc>' being compiled

c:\program files\microsoft visual studio 8\vc\include\vector(449) : error C2143: syntax error : missing ';' before '&'

c:\program files\microsoft visual studio 8\vc\include\vector(449) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\vector(450) : error C2065: '_Al' : undeclared identifier

c:\program files\microsoft visual studio 8\vc\include\vector(450) : error C3861: '_Myalloc': identifier not found

c:\program files\microsoft visual studio 8\vc\include\vector(451) : error C2531: 'std::vector<_Ty,_Alloc>::_Checked_array_allocator::_Al' : reference to a bit field illegal

c:\program files\microsoft visual studio 8\vc\include\vector(451) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\program files\microsoft visual studio 8\vc\include\vector(451) : error C2473: '_Al' : looks like a function definition, but there is no parameter list.

c:\program files\microsoft visual studio 8\vc\include\vector(454) : error C2143: syntax error : missing ';' before 'void'

c:\documents and settings\administrator\my documents\visual studio 2005\projects\test\test.cpp(9) : error C2065: 'vector' : undeclared identifier

c:\documents and settings\administrator\my documents\visual studio 2005\projects\test\test.cpp(9) : error C2062: type 'int' unexpected

Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\test\Debug\BuildLog.htm"

test - 11 error(s), 1 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Any clues

Thanks in advance.

Michael



Answer this question

What happened to vector?

  • Pela06

    Can you please provide a small example
    For me the following works perfectly in VC2005Express Beta2:
    #include <vector>
    int main()
    {
     std::vector<int> a;
     a.push_back(12);
     return 0;
    }

    ---
    Greetings
      Jochen



  • AlanW2

    Hi vze2dytt!

    any simply code like yours produces the results I reported in the original post. 
    ....
    But like I said, any code of mine which tries to include vector gets the syntax errors reported above. 

    Maybe you shoud reinstall on a clean machine...
    -- 
    Greetings
     Jochen
     
      My blog about Win32 and .NET
      http://blog.kalmbachnet.de/

  • Mark Goldstein

    any simply code like yours produces the results I reported in the original post. 

    here is the text of 'test.cpp' which generated the output above:

    #include<vector>

    using namespace std;

    int main()
    {
       vector<int> V;

       V.push_back(1);

       return 0;
    }

    But like I said, any code of mine which tries to include vector gets the syntax errors reported above. 


  • itdoug

     vze2dytt wrote:
    The problem was I was disabling language extensions, but it seems that /Za is a useless compiler switch now that they eliminated single threaded support. 


    The dependency of the STL implementation on /Ze (or the lack of /Za) has absolutely nothing at all to do with single or multi-threaded support.

     vze2dytt wrote:
    One apparently needs language extensions enabled if one is doing any multithreaded apps/dlls and there is no way NOT to program with multithreaded support. 


    Rubbish.  Language extensions and multi-threaded support are 100% orthogonal.  The only change was that the VC++ team decided to drop the single threaded CRT because:

    1.  Nearly all new programs being written today are multi-threaded.
    2.  There's little (or no) performance penalty for using the multi-threaded CRT in most cases.
    3.  There's less support burden in having two CRT versions to maintain than there is in having three versions to maintain.

     vze2dytt wrote:

    Its things like this that make me think more and more about moving to Linux...I mean, what is the big deal about supporting native C++ alongside their Visual C++   They are making it now such that one MUST use managed extensions. 


    Hogwash.  Compiling with /Ze (or no /Za) has nothing whatsoever to do with managed extensions.  Unless you're compiling with /clr you're not using managed extensions - and nothing in VC++ 2005 compels you to compile with /clr.

     vze2dytt wrote:

    In VS 2003, I can disable nearly all Microsoft stuff through compiler switches and use it as a very nice native C++ compiler that is much better than others I have used or tried.  With VS 2005 it now seems they don't want this to happen.


    I think you're severely over-reacting to something you clearly don't understand as well as you think you do.  The "extensions" that /Za disables are little backwards compatability tweaks to allow constructs like void main() to compile.  They're nothing sinister that's going to turn your native C++ code into WinForms without your permission.

  • Wobba

    Carl is right. You are confusing different concepts here.

    I want to briefly add that the fact that parts of our SCL don't compile under /Za is a bug. We expect the complete SCL implementation to compile /Za when Whidbey ships. I've recently done several of these fixes myself.

    No C++ program is forced to use any managed extensions. /Za is unrelated to /clr. In fact, you can compile /Za programs managed if you want to.

    Martyn Lovell
    Development Lead
    Visual C++ Libraries.

  • siugwan

    The problem was I was disabling language extensions, but it seems that /Za is a useless compiler switch now that they eliminated single threaded support.  One apparently needs language extensions enabled if one is doing any multithreaded apps/dlls and there is no way NOT to program with multithreaded support.  Its things like this that make me think more and more about moving to Linux...I mean, what is the big deal about supporting native C++ alongside their Visual C++   They are making it now such that one MUST use managed extensions. 

    In VS 2003, I can disable nearly all Microsoft stuff through compiler switches and use it as a very nice native C++ compiler that is much better than others I have used or tried.  With VS 2005 it now seems they don't want this to happen.

    Michael

  • What happened to vector?