473,218 Members | 1,435 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,218 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 26216
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: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.