LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   gcc STL include problem (https://www.linuxquestions.org/questions/programming-9/gcc-stl-include-problem-41295/)

finidi 01-13-2003 06:30 AM

gcc STL include problem
 
With gcc 2.95 an app was compiling OK (0 errors 0 warnings)... after the last upgrade to my system, gcc version now is 3.2 (Linux Red Hat 8.0), and start to receive many errors and warnings compiling that app...the only way I've found to build it is:

1)
#include <list.h>
#include <stack.h>
#include <vector.h>

instead of
#include <list>
#include <stack>
#include <vector>

and

2) CFLAGS=-Wno-deprecated

in the makefile.

Otherwise receive the warnings about deprecated headers OR sintactic errors when declaring an STL object.

Any help will be appreciated.

Mara 01-13-2003 02:45 PM

The thing is that GCC version 3+ has more strict rules when parsing. It just don't accept some constructions that were possible in earlier versions. Your solution is 100% correct.

GtkUser 01-13-2003 04:14 PM

Provide more code. Using .h is not correct.



#include<list>
#include<vector>

using std::list;
using std::vector;

finidi 01-14-2003 06:55 AM

Now it's all OK... many thanks to both.

I have to say the way finally I did... replaced all the .h headers with their c++ counterparts, and just added:

using namespace std;

with that, all goes as before the upgrade, but with the standard c++ headers.

Thanks again !!!


All times are GMT -5. The time now is 03:07 PM.