LinuxQuestions.org
Visit Jeremy's Blog.
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 03-06-2006, 04:33 AM   #1
karan101
Member
 
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 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.
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 04:38 AM.
 
Old 03-06-2006, 05:18 AM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 48
Code:
#include <ext/hash_map>
#include <functional>

using namespace std;
using namespace __gnu_cxx;
 
Old 03-06-2006, 06:01 PM   #3
karan101
Member
 
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, 03:52 PM   #4
karan101
Member
 
Registered: Aug 2004
Location: CANADA
Distribution: Fedora core4
Posts: 60

Original Poster
Rep: Reputation: 15
casting

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

Quote:
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 {
public:


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...
thanks
 
  


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


All times are GMT -5. The time now is 05:00 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