LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 02-08-2005, 12:27 PM   #1
prakashpms
LQ Newbie
 
Registered: Jun 2004
Posts: 15

Rep: Reputation: 0
Migrating from gcc 2.96 to 3.3.3


Hi,

I am facing problem while migrating an application from gcc 2.96 to gcc 3.3.3. The application was previously compiled on RedHat AS 2.1 and now I am compiling on Suse 9.1.

The program is something like this.

#include <string>

main()
{
string tmpString;
...................
}

It is compiling properly on RedHat AS 2.1 using gcc 2.96. On Suse 9.1 using gcc 3.3.3, it gives the following error.

error: 'string'undeclared (first use this function)
error: (Each undelcared identifier is reported only once for each function it appears in.)
error: syntax error before ';' token

Is there big difference between gcc 2.96 and 2.96. If I use 'using namespace std', I am able to resolve the compilation problem, but encounter the undefined reference linker error for std::basic_string.

Please let me know how do we solve this problem. Also, it will be helpful if you can point to any document for migrating from gcc 2.96 to 3.3.3.

Thanks & Regards
Prakash
 
Old 02-08-2005, 12:53 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
First off, if it is c++ (as it appears to be), you should use namespace std;. You should also compile using g++ which should link against the proper c++ libs then.
 
Old 02-08-2005, 01:33 PM   #3
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
If you want to use C's string.h header file then use #include <cstring> instead.
 
Old 02-09-2005, 03:08 AM   #4
prakashpms
LQ Newbie
 
Registered: Jun 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Hi all,

I forgot to use namespaces in the relevent header files and that is why the error was happening. After including the namespaces in the header file and the source file, it compiled properly using g++.

Thanks for the help.

Regards
Prakash
 
  


Reply



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
install after or before gcc,binutils,make,module-init when migrating kernel 2.6 eatmars Linux - Software 1 10-02-2005 12:52 PM
Migrating from gcc 2.96 to 3.3.3 prakashpms Linux - Software 3 02-08-2005 03:03 PM
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 02:13 PM
Migrating IglooGuy LinuxQuestions.org Member Intro 1 11-09-2003 03:36 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:08 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration