Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-06-2006, 03:33 AM   #1
Registered: Aug 2004
Location: CANADA
Distribution: Fedora core4
Posts: 60

Rep: Reputation: 15
using older version of g++

hello everyone

I have a program coded in C originally , we have to edit it and convert it to c++. well i did that with school's g++ compiler which is a version of 2.95.2 but my own g++ at home is version 4.0.1 and unlike the older version i can't compile it. I get the following error when i try to compile:
symtab.h:19:20: error: hash_map: No such file or directory
In file included from /usr/lib/gcc/x86_64-mandriva-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward/hash_map.h:59,
from symtab.h:20,
from main.cpp:18:
/usr/lib/gcc/x86_64-mandriva-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 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.
make: *** [main.o] Error 1
and my symtab.h start with this this:
#include <hash_map>
#include <hash_map.h>

#inlude <functional>
#include <fuctional.h>

also in my /usr/include folder i dont have hash_map and functional .... they are in /usr/include/g++-3. anybody can help me out on this? or is there i can get this compiled with my own compiler ?
thak you very much

Last edited by karan101; 03-06-2006 at 03:38 AM.
Old 03-06-2006, 04:18 AM   #2
Senior Member
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 50
#include <ext/hash_map>
#include <functional>

using namespace std;
using namespace __gnu_cxx;
Old 03-06-2006, 05:01 PM   #3
Registered: Aug 2004
Location: CANADA
Distribution: Fedora core4
Posts: 60

Original Poster
Rep: Reputation: 15
thank you

thank you , it worked
Old 03-08-2006, 02:52 PM   #4
Registered: Aug 2004
Location: CANADA
Distribution: Fedora core4
Posts: 60

Original Poster
Rep: Reputation: 15

I get this compilation error when i try to compile this line code under g++ 4.0.1 :

analyze.cpp: In member function ‘void Analyzer::incScope(TreeNode*)’:
analyze.cpp:321: error: cast from ‘TreeNode*’ to ‘int’ loses precision
and my code is this:

symobTable->incScope( int(t));

t is tree node which looks like this:

class TreeNode {

static const int MAXCHILDREN = 3;
TreeNode * child[MAXCHILDREN];
TreeNode * sibling;
int lineno;
NodeKind nodekind;
union {
DeclKind decl;
StmtKind stmt;
ExpKind exp;
} kind;

union {
TokenType op;
int val;
char * name;
} attr;

ExpType type;

int scope;
this code compiles under g++ 2.95 but not with 4.01 anybody knows what kind of casting I should be using or any way to get around this...


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
ndiswrapper older version... moosegoose Linux - Wireless Networking 1 09-19-2005 03:01 PM
Older Version Psycho(Clan) Linux - Newbie 3 04-02-2005 11:17 AM
using an older version of gcc win32sux Slackware 1 05-12-2004 01:53 AM
best version for older computer? jennyb Linux - Newbie 18 01-15-2003 02:13 PM
where can I get older version of mplayer? packman Linux - Software 8 11-03-2002 09:52 AM > Forums > Non-*NIX Forums > Programming

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

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