473,385 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

error: expected nested-name-specifier

Fab
Hi,

I try to compile a 2 years old project (successfully compiled with g++
3.3, if I correctly remember ).

But get problems now with g++ -gcc 4.2.3 :

#include <list>
#include <hash_map>

template<class>
class ListPtr;

template<class T>
class ListPtrIterator {

public:
ListPtrIterator( ListPtr< T >* _user ):
M_user( _user ),
M_cur( M_user->begin() ) {}

bool
cur( T*& );

bool
reset( void ) {
M_cur =M_user->begin();
return M_cur!=M_user->end();
}

private:
ListPtr< T >* M_user;
typename list< T* >::iterator M_cur;
^^^^
ERROR: expected nested-name-specifier before 'list'
};

Please do you know what's the problem ?
Has something changed in "typename" syntax ?

Thanks,

Fabrice
Dec 15 '07 #1
12 26339
Hi,

I don't see a

using namespace std;

in your code?

Regards, Ron AF Greve

http://www.InformationSuperHighway.eu

"Fab" <fa*************@free.frwrote in message
news:d2**********************************@n20g2000 hsh.googlegroups.com...
Hi,

I try to compile a 2 years old project (successfully compiled with g++
3.3, if I correctly remember ).

But get problems now with g++ -gcc 4.2.3 :

#include <list>
#include <hash_map>

template<class>
class ListPtr;

template<class T>
class ListPtrIterator {

public:
ListPtrIterator( ListPtr< T >* _user ):
M_user( _user ),
M_cur( M_user->begin() ) {}

bool
cur( T*& );

bool
reset( void ) {
M_cur =M_user->begin();
return M_cur!=M_user->end();
}

private:
ListPtr< T >* M_user;
typename list< T* >::iterator M_cur;
^^^^
ERROR: expected nested-name-specifier before 'list'
};

Please do you know what's the problem ?
Has something changed in "typename" syntax ?

Thanks,

Fabrice

Dec 15 '07 #2
Fab wrote:
Hi,

I try to compile a 2 years old project (successfully compiled with g++
3.3, if I correctly remember ).

But get problems now with g++ -gcc 4.2.3 :
typename list< T* >::iterator M_cur;
^^^^
ERROR: expected nested-name-specifier before 'list'
};
Should be std::list

Old gcc versions accepted standard containers in the global namespace.

--
Ian Collins.
Dec 15 '07 #3
Ron AF Greve wrote:

[please don't top post]
Hi,

I don't see a

using namespace std;
in your code?
Nor should you, if this is from a header...

--
Ian Collins.
Dec 15 '07 #4
BTW.

hash_map is a sgi extension AFAIK. I believe it is now located somewhere
else (then again you might have used a -I ext switch of course).

Regards, Ron AF Greve

http://www.InformationSuperHighway.eu

"Ron AF Greve" <ron@localhostwrote in message
news:47***********************@news.xs4all.nl...
Hi,

I don't see a

using namespace std;

in your code?

Regards, Ron AF Greve

http://www.InformationSuperHighway.eu

"Fab" <fa*************@free.frwrote in message
news:d2**********************************@n20g2000 hsh.googlegroups.com...
> Hi,

I try to compile a 2 years old project (successfully compiled with g++
3.3, if I correctly remember ).

But get problems now with g++ -gcc 4.2.3 :

#include <list>
#include <hash_map>

template<class>
class ListPtr;

template<class T>
class ListPtrIterator {

public:
ListPtrIterator( ListPtr< T >* _user ):
M_user( _user ),
M_cur( M_user->begin() ) {}

bool
cur( T*& );

bool
reset( void ) {
M_cur =M_user->begin();
return M_cur!=M_user->end();
}

private:
ListPtr< T >* M_user;
typename list< T* >::iterator M_cur;
^^^^
ERROR: expected nested-name-specifier before 'list'
};

Please do you know what's the problem ?
Has something changed in "typename" syntax ?

Thanks,

Fabrice


Dec 15 '07 #5
Fab
Thanks a lot for the explanations !

Yes, std:: perfectly solves the issue.

Thanks to have spoken about the changing of behaviour of gcc : the
makefile compiled before.
However I'm not surprised to run into problems in trying to build
this old project : because there were ugly things to be able to make
different gcc cope with SGI extensions.

Best regards,

Fabrice
Dec 15 '07 #6
Fab wrote:
Thanks a lot for the explanations !

Yes, std:: perfectly solves the issue.

Thanks to have spoken about the changing of behaviour of gcc : the
makefile compiled before.
However I'm not surprised to run into problems in trying to build
this old project : because there were ugly things to be able to make
different gcc cope with SGI extensions.
You will often find ugly things to get different gcc versions to cope
with other gcc versions!

Make sure you invoke the compiler in its standard conforming mode, to
save yourself problems in the future.

--
Ian Collins.
Dec 15 '07 #7
Fab
You will often find ugly things to get different gcc versions to cope
with other gcc versions!

Make sure you invoke the compiler in its standard conforming mode, to
save yourself problems in the future.

--
Ian Collins.
Thanks for the advice !

Now that all sources successfully compiles with gcc 4.2.3., I get lot
of linker errors that complains about dozens of undefined references
to stl internals.
Here is the first one :

cvtChar.o: In function `escape(char)':
cvtChar.c++:(.text+0x53c): undefined reference to
`stlpmtx_std::__node_alloc::_M_deallocate(void*, unsigned int)'

I add a -llibstlport to the Makefile libraries but dunno : remains
stuck.
I'm absolutely sure that the last time I built this project nothing
additional was required for the link.

Then I tried to build a stl-manual example : same kind of linker
error.
I've not used C++ for about one year but remember not to have such
kind of problems with old compiler versions.

Please do you have an idea about how to make the libstlport be found
at link stage ?
The packages :
libstlport4.6c2
libstlport5.1
libstlport5.1-dev
are installed on this Debian Sid.
Maybe is there a problem about different runtime libraries ?

Regards,

Fabrice
Dec 16 '07 #8
Fab wrote:
>You will often find ugly things to get different gcc versions to cope
with other gcc versions!

Make sure you invoke the compiler in its standard conforming mode, to
save yourself problems in the future.

Thanks for the advice !

Now that all sources successfully compiles with gcc 4.2.3., I get lot
of linker errors that complains about dozens of undefined references
to stl internals.
Here is the first one :

cvtChar.o: In function `escape(char)':
cvtChar.c++:(.text+0x53c): undefined reference to
`stlpmtx_std::__node_alloc::_M_deallocate(void*, unsigned int)'
You have stayed into the realms of gcc or Linux specific problems I'm
afraid. You should be able to get help from a Linux of gcc group.

--
Ian Collins.
Dec 16 '07 #9
Fab
You have stayed into the realms of gcc or Linux specific problems I'm
afraid. You should be able to get help from a Linux of gcc group.

--
Ian Collins.
You probably are right, will ask the question in a Linux forum.

Thanks,

Regards

Fabrice
Dec 16 '07 #10
On Dec 16, 5:47 am, Fab <fabricemarch...@free.frwrote:
You will often find ugly things to get different gcc versions to cope
with other gcc versions!
Make sure you invoke the compiler in its standard conforming mode, to
save yourself problems in the future.
--
Ian Collins.

Thanks for the advice !

Now that all sources successfully compiles with gcc 4.2.3., I get lot
of linker errors that complains about dozens of undefined references
to stl internals.
Here is the first one :

cvtChar.o: In function `escape(char)':
cvtChar.c++:(.text+0x53c): undefined reference to
`stlpmtx_std::__node_alloc::_M_deallocate(void*, unsigned int)'

I add a -llibstlport to the Makefile libraries but dunno : remains
stuck.
I'm absolutely sure that the last time I built this project nothing
additional was required for the link.

Then I tried to build a stl-manual example : same kind of linker
error.
I've not used C++ for about one year but remember not to have such
kind of problems with old compiler versions.

Please do you have an idea about how to make the libstlport be found
at link stage ?
The packages :
libstlport4.6c2
libstlport5.1
libstlport5.1-dev
are installed on this Debian Sid.
Maybe is there a problem about different runtime libraries ?

Regards,

Fabrice
Try out ldd command to find out if you are linking to the correct
library. -llibstlport might not just be sufficient in that you would
need to tell the LIB_PATH,LD_LIBRARY_PATH (whatever your compiler
understands) as well about where the library is (not just the
includes).
Dec 16 '07 #11
Fab
Thanks !
Try out ldd command to find out if you are linking to the correct
library.
I however thought ldd was only able to list the needed libraries for
an existing executable ? It's unfortunately not yet the case.
-llibstlport might not just be sufficient in that you would
need to tell the LIB_PATH,LD_LIBRARY_PATH (whatever your compiler
understands) as well about where the library is (not just the
includes).
About this you are certainly right. I perform some trials.

Regards,

Fabrice
Dec 16 '07 #12
Fab
Leaved stlport5.1 and went back to 4.6..
Things ended to successfully build.
The link stage :
g++ -O3 -I /usr/include/stlport -lreadline -o k /usr/lib/
libstlport_gcc.so cvtChar.o readline.o input.o Form.o Overload.o
read.o eval.o print.o banner.o repl.o keywords.o

Were specifying stl lib this way, like a ".o" /usr/lib/
libstlport_gcc.so is absolutely ugly.
I don't worry about this : I just needed to build the executable and
maybe to add small changes on it to print some internals. This just to
understand how it works.

Regards,

Fabrice
Dec 16 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Rhino | last post by:
I am having a problem with a nested SQL Procedure on DB2 V8.2.1 on Windows. This simple-looking proc is giving me this error message when I try to build it in the Development Center: ...
6
by: Jonathan LaRosa | last post by:
I am trying to open a recordset and I am getting an error and I can't figure out why. See code below. sqlString2 does not work. sqlString does. Clearly the problem is with the nested SELECT...
4
by: .Net Sports | last post by:
The following error message is baffling me : Compiler Error Message: CS1026: ) expected <asp:Literal id="lblAmount_Attempted" runat="server" text='<%# DataBinder.Eval(Container.DataItem, _...
2
by: Jeffrey Melloy | last post by:
I have been using tsearch2 for quite a while with a fair amount of success. The other day I was playiing around with a query, and randomly changed a few things. I noticed a 10 times speedup and...
5
by: cody | last post by:
the following leads to an error (note that TEST is not defined): #if TEST string s = @" #"; // <-- the error is "preprocessing directive expected" #endif also, here we get the same error: ...
6
by: massic80 | last post by:
Hi, it's me again! I have a strange problem with a form I gotta (dynamically) insert in a site, and copied/pasted the code to a blank page, to make it easier to try it out. I was using the $...
4
by: rach | last post by:
I just started to learn C++. I copied the following code from a data structure textbook to a ".h" file and couldn't compile it. The code contains three template interfaces. One inherits another. The...
0
by: AncaT | last post by:
Hi, I have just started working w/ asp.net, vb.net. I have a .aspx page that contains user defined controls. Inside these controls, I have a 'Delete' hyperlink. This is the code: Inside...
3
by: krunalb | last post by:
hi, I am facing compilation error for following snippet: Compilation Error: t7.cc:17: error: expected `)' before '*' token <code snippet>
3
by: rorni | last post by:
Hi, I'm porting code from Windows to HP-UX 11, compiling with g++. I'm getting a compilation error on the system's debug.h include file, which is included very indirectly through a series of...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.