Problems IFstream.H in OpenFoam-2.1.0
I have OpenFoam2.1.0 installed on Mac OS X.
I tried to read and write a text file to get a special parameter and save some output. Whenever I include either of header files IFstream.H, OFstream.H, or stream.h on my application I get compilation errors. Here is the output message: ------------------Begin of included text ------------------------------ SOURCE=escoamentoFoam.C ; g++-mp-4.5 -m64 -DdarwinIntel64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O2 -DNoRepository -ftemplate-depth-100 -I/Users/murilo/OpenFOAM/OpenFOAM-2.0.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/Users/murilo/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude -I/Users/murilo/OpenFOAM/OpenFOAM-2.0.x/src/OSspecific/POSIX/lnInclude -fPIC -Ddarwin -c $SOURCE -o Make/darwinIntel64Gcc45DPOpt/escoamentoFoam.o In file included from /opt/local/include/gcc45/c++/fstream:42:0, from /Users/murilo/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude/OFstream.H:42, from escoamentoFoam.C:45: /opt/local/include/gcc45/c++/bits/codecvt.h: In function 'int main(int, char**)': /opt/local/include/gcc45/c++/bits/codecvt.h:42:1: error: expected '=' before '__attribute__' /opt/local/include/gcc45/c++/bits/codecvt.h:42:1: error: expected identifier before '__attribute__' /opt/local/include/gcc45/c++/bits/codecvt.h:42:1: error: expected ';' before '__attribute__' /opt/local/include/gcc45/c++/bits/codecvt.h:42:1: error: expected primary-expression before '__attribute__' /opt/local/include/gcc45/c++/bits/codecvt.h:42:1: error: expected ';' before '__attribute__' escoamentoFoam.C:154:1: error: expected '}' at end of input make: *** [Make/darwinIntel64Gcc45DPOpt/escoamentoFoam.o] Error 1 -------- End of included lines -------------------------------------------------- I saw some previous posts about similar errors with bits/codecvt.h but I could not find a solution to my problem. I believe the problem resides in some environment variables that are not properly set in my system. Did anyone had similar problem ? Any clue in how to fix it? Thanks in advance. Murilo |
Greetings Murilo and welcome to the forum!
You can check the following test application for ideas (these commands will build it as well): Code:
foam If it builds successfully, then you can compare how that application works versus the one you're developing! Best regards, Bruno |
Thanks Bruno,
I just figured out, doing some try and error tests that the problem I had was related to the place where I put the #include <fstream> line. The solution: If I insert it outside the main code I get no problem. Thanks a lot for your reply. Murilo |
All times are GMT -4. The time now is 21:04. |