ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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++.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.