LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-30-2008, 05:10 AM   #1
samitpmc
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Rep: Reputation: 0
wstring compilation using gcc 3.2.3 on FreeBSD 4.8


Hi,

I want to use wstring on FreeBSD 4.8.
FreeBSD 4.8 by default had gcc 2.95.

So I have installed gcc 3.2.3

Now when I am compiling sample code

==============================
#include <iostream>
#include <string>
int main(int argc, char* argv[])
{
std::wstring str(L"Ashutosh");
return 0;
}
==============================

while compiling using 'g++ sample.cpp'

I am getting error:

sample.cpp: In function `int main()':
sample.cpp:5: `wstring' undeclared in namespace `std'
sample.cpp:5: syntax error before `(' token

I think problem with some configuration but dont know how to fix it.

Any help will be highly appreciated.

Thanks & Regards,
 
Old 07-30-2008, 06:13 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Using gcc (g++) 4.2.3, it works fine.

gcc 3.2.3 is very old... I wonder if that was before the implementation of the standards regarding headers and STL contents?

IIRC back in those olden days string and friends weren't in the std namespace. Try it without the std:: prefix.
 
Old 07-30-2008, 07:10 AM   #3
samitpmc
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Original Poster
Rep: Reputation: 0
removing std:: doesn't help
 
  


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
have gcc compilation error during gcc installtion in linuxfromscratch vbshanmugaprakash Linux - General 3 12-13-2006 05:52 AM
gpm compilation on gcc 4.x... marekjs Slackware 3 06-27-2006 04:33 AM
compilation prob with gcc srinis Linux - Newbie 2 03-11-2005 04:06 PM
equivalent for wstring pippet Programming 4 12-30-2004 04:00 PM
GCC 3.4.0 Compilation Crashes derryp Linux From Scratch 3 06-11-2004 04:22 PM

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

All times are GMT -5. The time now is 05:55 PM.

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