This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-3.2 can not locate stl containers (vector, map, ... etc)


Hi,

you have probably a problem with the namespace std. You have to use "std::vector" instead of "vector" or you can put at the beginning of the file: using namespace std;
, which avoids that you'll have to write always the prefix "std::"


This is the case for all STL (vectro, map, algorithm, ...) and for the iostream (cout, cerr, etc.) too.

I hope that helps you out,

Andres

p.d. the ISO C++ demands that the standard include file do not have the suffix .h, e.g. #include <vector> instead of #include <vector.h>


From: Saeed Eskandari <eskandar at cae dot wisc dot edu>
To: gcc-help at gcc dot gnu dot org
Subject: gcc-3.2 can not locate stl containers (vector, map, ... etc)
Date: Thu, 06 Mar 2003 17:20:31 -0600

Hello,
I recently upgraded my system from redhat Linux 7.2 with gcc-2.95 to RedHat
Linux 8.0 with gcc-3.2 .

I have a program which has been compiled and linked by gcc-2.95 without any
problem. However after upgrading my system my program no longer compile.


I get a lot of compiler error messages, mostly regarding to STL containers and
algorithms. A few lines are as following :


:210: syntax error before `;' token
:213: 'string' is used as a type, but is not defined as a type.
:214: `int UV_ROISize' used prior to declaration
:224: `QColor*targetLedColor' used prior to declaration
:229: 'deque' is used as a type, but is not defined as a type.
:230: 'deque' is used as a type, but is not defined as a type.
:231: 'deque' is used as a type, but is not defined as a type.
:232: 'deque' is used as a type, but is not defined as a type.
:238: 'vector' is used as a type, but is not defined as a type.
:239: 'vector' is used as a type, but is not defined as a type.
:240: 'vector' is used as a type, but is not defined as a type.

I  added the location of the  stl (std)  header files by -I flag but it did
not resolve
my problem.

I appreciate if you share with me your opinion about how to solve this
problem.  Please let me know if you need any further information.

I just learned that my problem might be because of including std namespace in
my program. However my program is relatively big (20K +) and I do not want
prepend any single stl construct with std:: .
would you please suggest any simple way to resolve this problem without
changing my program?


Regards,
Saeed

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: http://messenger.yupimsn.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]