Download your favorite Linux distribution at LQ ISO.
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 02-08-2005, 12:27 PM   #1
LQ Newbie
Registered: Jun 2004
Posts: 15

Rep: Reputation: 0
Migrating from gcc 2.96 to 3.3.3


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>

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
Old 02-08-2005, 12:53 PM   #2
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
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
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.



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
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 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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:49 AM.

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