tags:

views:

305

answers:

1

I am using Eclipse on windows with the MinGW tool chain (g++, etc.). I have a program that I built on darwin that reads and writes to files using wifstream and wofstream. The program comiles and works find using eclipse on darwin (Mac)...no for my problem.

When I move the code over to windows and try to build in using the MinGW tool chain and eclipse, I get a compile error on wifstream, wofstream, and wcout. Variables defined as wstring compile just fine.

For example:

wifstream inFile; inFile.open(argv[2], ios_base::in);

results in a compile error

..\src\pdConv.cpp:31: error: `wifstream' was not declared in this scope

which seems to indicate that the compiler thinks wifstream is a variable. I did notice that the _GLIBCXX_USE_WCHAR_T directive is not enabled in the include files. Do I need to define this myself or is something in the environment supposed to know this? If I define it manually then it appears I cant use both wide and narrow implementations in the same program.

This is probably obvious but I have been stuck in this problem for to long...lol..What am I missing here?

+2  A: 

Basically, this isn't supported with MinGW. See this link I suppose it's possible the the very latest gcc (4.4.0) that is available for MinGW solves this, but I wouldn't count on it. Looks like using STLPorts might be your only option if you need to stick with MinGW.

Matthew Talbert
OMG! Thank you for the response. I thought I was going crazy. I have spent an embarrassing amount of time on this issue and could find nothing much from google searches. You are a lifesaver. I will look at the STLPorts library and see if that works better. I am using MinGW on windows because it seems eclipse found the tool chain...I had tried Cygwin first, but I could not get anything to compile. It is so much easier on the *nix side. Thanks again!
Cryptik
Would you mind marking this as "answered" and upvoting my answer?
Matthew Talbert