CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Bug in OFstreamH

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 2, 2007, 04:11
Default Hello, I have a solver that
  #1
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 100
Rep Power: 8
tehache is on a distinguished road
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 is offline   Reply With Quote

Old   February 2, 2007, 04:34
Default to whom it may concern: jus
  #2
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 100
Rep Power: 8
tehache is on a distinguished road
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 ...
tehache is offline   Reply With Quote

Old   February 2, 2007, 05:03
Default I see two mistakes. 1) includ
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 777
Rep Power: 18
olesen will become famous soon enough
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.
olesen is offline   Reply With Quote

Old   May 8, 2009, 03:51
Default it is real problem
  #4
New Member
 
Su Xiaohui
Join Date: Mar 2009
Location: Singapore
Posts: 29
Rep Power: 8
sxhdhi is on a distinguished road
Send a message via Skype™ to sxhdhi
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
sxhdhi is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 22:08.