CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Bug in OFstreamH (https://www.cfd-online.com/Forums/openfoam-solving/59839-bug-ofstreamh.html)

tehache February 2, 2007 03:11

Hello, I have a solver that
 
Hello,

I have a solver that compiles and runs fine, using the gcc provided with OpenFOAM-1.3.
Now I wanted to add an OFstream, but even simply including OFstream.H at the beginning of my code, as the only change, I get this:

~/OpenFOAM/jung-1.3/incompbuoy_axitest1>wmake
make: Nothing to be done for `allFiles'.
Making dependency list for source file incompbuoy.C

SOURCE_DIR=.
SOURCE=incompbuoy.C ; g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/home/data1/jung/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/home/data1/jung/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread -c $SOURCE -o Make/linuxGcc4DPOpt/incompbuoy.o
/home/data1/jung/OpenFOAM/linux/gcc-4.1.0/bin/../lib/gcc/i686-pc-linux-gnu/4.1.0 /../../../../include/c++/4.1.0/i686-pc-linux-gnu/bits/basic_file.h: In function 'int main(int, char**)':
/home/data1/jung/OpenFOAM/linux/gcc-4.1.0/bin/../lib/gcc/i686-pc-linux-gnu/4.1.0 /../../../../include/c++/4.1.0/i686-pc-linux-gnu/bits/basic_file.h:47: error: expected primary-expression before 'namespace'
/home/data1/jung/OpenFOAM/linux/gcc-4.1.0/bin/../lib/gcc/i686-pc-linux-gnu/4.1.0 /../../../../include/c++/4.1.0/i686-pc-linux-gnu/bits/basic_file.h:47: error: expected `;' before 'namespace'
/home/data1/jung/OpenFOAM/linux/gcc-4.1.0/bin/../lib/gcc/i686-pc-linux-gnu/4.1.0 /../../../../include/c++/4.1.0/fstream:51: error: expected primary-expression before 'namespace'
/home/data1/jung/OpenFOAM/linux/gcc-4.1.0/bin/../lib/gcc/i686-pc-linux-gnu/4.1.0 /../../../../include/c++/4.1.0/fstream:51: error: expected `;' before 'namespace'
/home/data1/jung/OpenFOAM/linux/gcc-4.1.0/bin/../lib/gcc/i686-pc-linux-gnu/4.1.0 /../../../../include/c++/4.1.0/bits/fstream.tcc:45: error: expected primary-expression before 'namespace'
/home/data1/jung/OpenFOAM/linux/gcc-4.1.0/bin/../lib/gcc/i686-pc-linux-gnu/4.1.0 /../../../../include/c++/4.1.0/bits/fstream.tcc:45: error: expected `;' before 'namespace'
/home/data1/jung/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude/OFstream.H:48: error: expected primary-expression before 'namespace'
/home/data1/jung/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude/OFstream.H:48: error: expected `;' before 'namespace'


The code is simply this:

#include "fvCFD.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{

# include "OFstream.H"

# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "readEnvironmentalProperties.H"

# include "createFields.H"
# include "initContinuityErrs.H"




//OFstream kinlog("bla");



.... and some more - but, as said, removing the inclusion of OFstream it compiles.

any idea someone ?

Thank you very much !

tehache February 2, 2007 03:34

to whom it may concern: jus
 
to whom it may concern:

just found out that including OFstream.H BEFORE fvCFD.H everything is fine.

Dont really understand that, but ...

sorry for bothering ...

olesen February 2, 2007 04:03

I see two mistakes. 1) includ
 
I see two mistakes.
1) including a header file within main()
2) fvCFD.H conveniently includes lots of things for you, including adding a "using namespace Foam;" at the end, which likely upsets lot of other header files (not just OFstream.H) that you include after.

sxhdhi May 8, 2009 03:51

it is real problem
 
yes, I also met the same problem. and although it can be fixed just followed the suggestion mentioned in this thread. it becomes uncomfortable, isn't it?

Su Xiaohui


All times are GMT -4. The time now is 11:31.