CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2001
    Location
    Toronto
    Posts
    118

    Unhappy STL in MFC-based Application -- help pls!!!

    I include
    #include <vector>
    using namespace std;
    and declare the following in CMyApp class header file
    std::vector<int> a(3);
    but the compiler gave me error C2059: syntax error : 'constant' !!!
    I do not know if there are any special setting in the compiler (I am using VC++6.0+SP5).
    Any idea will be highly appreciated, Thank you.

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725
    Here is one way ...

    • change in header file:
      Code:
      std::vector<int> a;
    • in the CMyApp constructor :

      Code:
      a.resize(3);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured