Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem declaring a STL vector in RAD 2009 and Windows 7 1

Status
Not open for further replies.

rlev

Programmer
Feb 13, 2010
8
0
0
US
I am using Rad Studio 2009 on a windows 7 OS.

My code is simple
//------------------

#include <vcl.h>
#pragma hdrstop

#include <vector>
#include "Main.h"

using namespace std;

vector <int> myvector; <==== line that throw error

#pragma package(smart_init)
#pragma resource "*.dfm"

the error is :

[BCC32 Error] Main.cpp(23): E2141 Declaration syntax error

Can somebody tell me what is the syntax error?

Is this a issue with Rad 2009 and windows 7 issue because I remember using STL container with RAD 2009 and Vista and compiled with no problem....?

Thanks in advance.
 
I don't use 2009 and I haven't used vectors in 2010 but i do use them in BCB6. Try this:
Code:
    using std::vector; // instead of using namespace std;
    vector<int> myvector; // no space between vector and <int>
The namespace may not be a problem but worth a try.






James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thanks James,

I just figured out that it was a include path problem in the RAD IDE.....now is compiling.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top