This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/23990] New: compiling code with "wchar_t" .. gives linking error
- From: "a_manish at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Sep 2005 09:31:54 -0000
- Subject: [Bug libstdc++/23990] New: compiling code with "wchar_t" .. gives linking error
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
I am facing a problem while compiling following code with gcc.
When i compile ofstream with "char", it compiles fine.
But it gives linking error with "wchar_t".
I compile with command "gcc test.cpp"
Could someone please look into this and let me know if i need additional
library to compile with ? or what is the exact issue ?
=================================================================
#include <iostream>
#include <istream>
#include <stdio.h>
#include <wchar.h>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <iosfwd>
using namespace std;
int main(void)
{
//typedef basic_ofstream<char, char_traits<char> > wofstream;
typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
wofstream wstr;
wstr.open("test.txt",ios::app);
char *abc="TEST";
//str<<abc;
string t = "TEST1";
wchar_t *def=0;
def=(wchar_t*)t.c_str();
wprintf(L"%s\n",def);
//print to file -start
wstr<<"\nNEW RUN\n";
wstr<<(*def);
wstr<<"\nEND\n";
//print to file -end
wstr.close();
return 0;
}
=================================================================
Thanks in advance.
Manish
--
Summary: compiling code with "wchar_t" .. gives linking error
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: a_manish at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23990