LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-06-2005, 09:38 AM   #1
tandre
Member
 
Registered: Apr 2003
Location: Portugal
Distribution: Fedora Core 3
Posts: 61

Rep: Reputation: 15
Error due to old version of gcc (probably)


does anyone can tell me what is the solution to this error:

/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning Thisfile includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
ANPcycle.cc: In member function `virtual void ANPcycle::expire(Event*)':
ANPcycle.cc:443: error: no match for 'operator!=' in '((ANPcycle*)this)->ANPcycle::visits_->std::map<_Key, _Tp, _Compare, _Alloc>::find [with _Key = nsaddr_t, _Tp = nsaddr_t, _Compare = ltnsaddr, _Alloc = std::allocator<std::pair<const nsaddr_t, nsaddr_t> >](((const nsaddr_t&)((const nsaddr_t*)(((ANAnt*)this)->ANAnt::neighbor_ + (+(((unsigned int)j) * 4u)))))) != ((ANPcycle*)this)->ANPcycle::P_->std::map<_Key, _Tp, _Compare, _Alloc>::end [with _Key = nsaddr_t, _Tp = double, _Compare = ltnsaddr, _Alloc = std::allocator<std::pair<const int, double> >]()'
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/stl_tree.h:213: note: candidates are: bool std::_Rb_tree_iterator<_Tp>::operator!=(const std::_Rb_tree_iterator<_Tp>&) const [with _Tp = std::pair<const nsaddr_t, nsaddr_t>]
make: *** [ANPcycle.o] Error 1

it is probably due to gcc version...
Thanks
 
Old 04-07-2005, 05:36 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,535

Rep: Reputation: 148Reputation: 148
Use <stream> instead of <stream.h>, <map> instead of <map.h> and so on. In the error message you're showing I can't see which file is it about.

Could you please paste a short piece of code?
 
Old 04-12-2005, 06:17 AM   #3
tandre
Member
 
Registered: Apr 2003
Location: Portugal
Distribution: Fedora Core 3
Posts: 61

Original Poster
Rep: Reputation: 15
Iam sorry for the delay in the post...

well when i try to remove the .h extensions as u say i get
ANPcycle.cc:39:17: stdio: No such file or directory
ANPcycle.cc:41:16: math: No such file or directory
ANPcycle.cc:42:24: g++-3/vector: No such file or directory
ANPcycle.cc:43:26: values: No such file or directory
ANPcycle.cc:45:15: tcl: No such file or directory
ANPcycle.cc:46:15: rng: No such file or directory
ANPcycle.cc:47:20: ANPcycle: No such file or directory
ANPcycle.cc:48:20: ANActive: No such file or directory

The part of the error in the file is this:
for (int j = 0; j < numneighbors_; j++) {
if (visits_->find(neighbor_[j]) != P_->end() &&
neighbor_[j] != lastnode_ &&
neighbor_[j] != next) {
// Remember the two highest alien capasity request
alien_cap = get_alien_cap_req(neighbor_[j]) / 2.0;
if (alien_cap > max_cap_) {
max_cap_ = alien_cap;
} else if (alien_cap <= max_cap_ && alien_cap > max2_cap_) {
max2_cap_ = alien_cap;
}
}
}


Thansk in advance...
 
Old 04-12-2005, 05:42 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,535

Rep: Reputation: 148Reputation: 148
I wasn't as precise as I wanted to...
Quote:
well when i try to remove the .h extensions as u say i get
ANPcycle.cc:39:17: stdio: No such file or directory
ANPcycle.cc:41:16: math: No such file or directory
stdio and math must be with .h Removing .h is needed for standard C++ (and STL headers).
Quote:
ANPcycle.cc:42:24: g++-3/vector: No such file or directory
only <vector> ?
Quote:
ANPcycle.cc:43:26: values: No such file or directory
ANPcycle.cc:45:15: tcl: No such file or directory
ANPcycle.cc:46:15: rng: No such file or directory
ANPcycle.cc:47:20: ANPcycle: No such file or directory
ANPcycle.cc:48:20: ANActive: No such file or directory
Those also need .h probably.

Which line from the code you provided is line 443 exactly? I think it's about
Quote:
visits_->find(neighbor_[j]) != P_->end()
Check types of those two exactly. They don't match. My guess is (the message is very unclear) is that you need to make value from the iterator you get from find().
 
Old 04-13-2005, 11:01 AM   #5
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 31
Are you using gcc or g++ to compile? For C++, you should be using g++.

Standard C++ headers don't use the .h extension. (e.g. <iostream>, <vector>, <string>, etc.) Standard C headers are pre-pended with a c and the .h is dropped. (e.g. <stdio.h> becomes <cstdio>) All other non-standard headers generally use the .h...

The new header names basically put everything into a namespace named std. So... you need to provide the full scope to the objects and functions within them, or use the "using namespace std;" line to inject those items into the global namespace. (Or use the using statment to inject only specific items from the namespace.)

Anyway, not sure if any of that is your problem or not, but it's some general guidelines that you can try. If you still can't get it to work, try posting more code, (Formatted between [code ] [ /code] tags, please...)

Last edited by deiussum; 04-13-2005 at 11:02 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding distribution + kernel version + gcc version + glib version. JCipriani Linux - General 8 04-19-2008 02:54 PM
Error USB-HUC on booting due in mdk10 due to mx700 Boudewijn Mandriva 4 10-09-2004 08:36 AM
redhat fedora gcc version (compiled for 2.4.20) doesn't match kernel version 2.4.22 start1000 Linux - Software 0 03-16-2004 08:17 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM
Sample Driver Module incompatibility with Kernel version (or gcc version) jvs Linux - General 1 06-07-2002 01:40 AM


All times are GMT -5. The time now is 04:52 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration