while vc++6 succeeds, g++ fails. ???


 
Thread Tools Search this Thread
Top Forums Programming while vc++6 succeeds, g++ fails. ???
# 1  
Old 05-30-2007
while vc++6 succeeds, g++ fails. ???

My code is at:
http://rafb.net/p/E82U3C73.html
It is a concept sample. I desperately tried to compile it with g++. To my surprise (in vmplayer/ win2k) vc++6 succeeds to compile it.
I'm in very doubt. I used RedHat WS 4 , g++-3.4 and Debian Etch, g++-4.1
Comment this please!!
mihai [mihk]
# 2  
Old 05-30-2007
On Tiger....

Code:
myList.h:12: error: type 'std::list<T, std::allocator<_CharT> >' is not derived from type 'myList<T>'
myList.h:12: error: expected ';' before 'iterator'
myList.h:13: error: type 'std::list<T, std::allocator<_CharT> >' is not derived from type 'myList<T>'
myList.h:13: error: expected ';' before 'const_iterator'
myList.h: In member function 'void myList<T>::constIt(const myList<T>&) const':
myList.h:17: error: 'const_iterator' was not declared in this scope
myList.h:17: error: expected `;' before 'cit'
myList.h: In member function 'void myList<T>::It()':
myList.h:23: error: 'iterator' was not declared in this scope
myList.h:23: error: expected `;' before 'itb'

with

Code:
powerpc-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Then on Solaris 10 with Studio11

Code:
bash-3.00$ PATH=/opt/SUNWspro/bin:$PATH \
> CC=/opt/SUNWspro/bin/cc \
> CXX=/opt/SUNWspro/bin/CC \                                                   
> /opt/SUNWspro/bin/CC main.cpp -I.
"myList.h", line 12: Warning (Anachronism): Type names qualified by template parameters require "typename".
"main.cpp", line 5:     Where: While specializing "myList<T>".
"main.cpp", line 5:     Where: Specialized in non-template code.
"myList.h", line 13: Warning (Anachronism): Type names qualified by template parameters require "typename".
"main.cpp", line 5:     Where: While specializing "myList<T>".
"main.cpp", line 5:     Where: Specialized in non-template code.
2 Warning(s) detected.

Does it matter that int is not a class?
# 3  
Old 05-30-2007
Try this:

Code:
	typedef typename std::list<T>::iterator        iterator ;
	typedef typename std::list<T>::const_iterator  const_iterator ;

# 4  
Old 05-30-2007
That fix worked on g++-4.0.1.
# 5  
Old 05-31-2007
Thanks for posts !! It worked out. mihk
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to know why crontab -e fails

more cron.txt 1 * * * * /u/ways.sh 2>&1 >/dev/null bash-4.1$ export EDITOR=vi bash-4.1$ crontab -e <cron.txt Vim: Warning: Input is not from a terminal Vim: Error reading input, exiting... Vim: Finished. The crontab file was not changed. bash-4.1$ echo $? 1 bash-4.1$ uname -a SunOS... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. UNIX for Advanced & Expert Users

Sendmail succeeds, qmail fails

I am attempting to send multipart formatted email using sendmail -t with attachments. The attachments always arrive as empty if sent from linux. They are intact if sent from AIX. Does qmail not support attachments for multipart formatted email? I have a legacy application which runs... (4 Replies)
Discussion started by: charles_n_may
4 Replies

3. UNIX for Dummies Questions & Answers

read fails in Unix, but succeeds in Linux. Why?

Hi, When I use "read" to parse the sftp command sent via ptty, I ran into a very mysterious case below: --- In Unix, the command ‘quit' is lost. === Fri 13Apr12 15:42:47GMT-sftp_send_command: SENT Fri 13Apr12 15:42:47GMT-sftp_read_resp_line: Parse buffer=quit^M --> Command sent correctly... (2 Replies)
Discussion started by: HgHK
2 Replies

4. HP-UX

shl_load fails

Hi, I have written a simple program of 2 lines in C to load a library using SHL_LOAD. It fails with error "/usr/lib/hpux32/dld.so: Unable to find library 'xyz.sl'. Load failure for library , ERRNO = 2" Shlib_PATH,LD_LIBRARY_PATH,PATH,LD_PRELOAD are set correctly and library exists on the... (0 Replies)
Discussion started by: ashwinichavan
0 Replies

5. Red Hat

mkinitrd fails

hi, i´ve been the last 48 hours with this issue.... after clone another system to a new one with lvm, the last step is mkinitrd. i execute it and it finish, but some errors are sent to stderrr. /sbin/mkinitrd: line380: gawk: command not found Traceback (most recent call last) File... (0 Replies)
Discussion started by: pabloli150
0 Replies

6. Shell Programming and Scripting

Expect: Block of lines should be executed only if access succeeds

Hello I'm using expect to create a script. I want some lines to be executed only if the telnet succeeds to the target host. Kindly check the code that i created. The problem i'm facing that while execting the script, the lines after login seems to be ignored. The password is not sent and also... (2 Replies)
Discussion started by: Hossam_Nox
2 Replies

7. Shell Programming and Scripting

execute ftp script until it succeeds

I have a ftp script that occasionally fails (connection lost error). I would like to execute the ftp command until it succeeds. Would the script below work? while do ftp -i -n <<EOF >> $LOG open $FTP_HOST user $FTP_LOGIN $FTP_PASSWD put filename.csv bye quit ... (5 Replies)
Discussion started by: soliberus
5 Replies

8. UNIX for Advanced & Expert Users

why script fails sometime?

Hi, I am trying to run a shell script on solaris,some time it works fine and some times it fails unexpectedly. There is a script called "autostart.sh" which automatically starts the Application server but some times the script fails to strat the application server. can anyone tell me what... (10 Replies)
Discussion started by: tahir23
10 Replies

9. Shell Programming and Scripting

fgrep fails...!?

Hi all, I need to transport a number of files from one server to other. I like to ensure the integrity using file checksum values. The action plan is, 1. create the list of checksum values for all the files using cksum command in source server. 2. Transfer all the files including the file... (5 Replies)
Discussion started by: r_sethu
5 Replies

10. AIX

SCP fails sometimes

Hi, I got a unix script which copies a file from my AIX machine to a file server using SCP command. I am calling this script 3 times in my process after a time interval say 5mins. My issue here is like most of the time its not sending the file at the first time run while other 2 will work fine.... (10 Replies)
Discussion started by: vipinc
10 Replies
Login or Register to Ask a Question