CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

error: "namespace definition is not allowed here"

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

Like Tree1Likes
  • 1 Post By gwierink

LinkBack Thread Tools Display Modes
Old   October 24, 2012, 10:55
Default error: "namespace definition is not allowed here"
New Member
Join Date: Oct 2012
Posts: 3
Rep Power: 4
meinenn is on a distinguished road
I'm trying to adapt the twoPhaseEulerFoam solver in a way, that one can use the LaunderGibsonRSTM turbulence model instead of the kEpsilon model. I replaced the corresponding line in the main code (in myTwoPhaseEulerFoam.C) an defined all the necessary links in the make/options file. So far, everything is clear and ok.
Now, I'm trying to compile the new solver (with wmake) an I get always the same errors: for 6 H-files, the error "namespace definition is not allowed here" occurs. These are all unchanged files at the original place, so a bug in these files can be excluded, I assume.
Online, I found some similar problem descriptions, but without solutions. And I really have no idea in which direction I have to look for the solution...
Does somebody know this problem? I'd be really glad about an answer :-)
Thanks in advance!

PS: I'm working with OpenFoam 1.7.1
meinenn is offline   Reply With Quote

Old   October 24, 2012, 17:16
Senior Member
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi Nik,

The reason is that you include a file with a namespace declaration where you shouldn't. Just test it by copying the original twoPhaseEulerFoam and putting
namespace Foam
at the top of kEpsilon.H and of course a closing curly bracket "}" at the bottom and try to compile. So, the problem is probably that you're including a class (e.g. LaunderGibsonRSTM.H) with a namespace declaration.
PicklER likes this.
Regards, Gijs
gwierink is offline   Reply With Quote

Old   October 25, 2012, 04:47
New Member
Join Date: Oct 2012
Posts: 3
Rep Power: 4
meinenn is on a distinguished road
Thanks a lot for your answer. I also had the idea to test the original twoPhaseEulerFoam and I surprisingly remarked that there I get the same error message. Although, it is possible to run a case with my new solver, I just do not know if everything works fine or not, the results I get are generally quite reasonable, but a "rest-uncertainty" is still there. I think I have to discuss that tomorrow with my thesis-supervisor...
If I get more insight in that problem, I'll post that solution here...
meinenn is offline   Reply With Quote

Old   July 6, 2015, 11:36
Default namespace definition not allowed here
New Member
Join Date: Jun 2015
Posts: 5
Rep Power: 2
KHoy is on a distinguished road
Hi everyone,

I, too, have this error when I am trying to compile meltFoam after changing the include file from readSIMPLEControls.H to simpleControl.H. In this thread it is suggested that the namespace is included where it shouldn't be.
However the simpleControl.H has the following lines:
#include "solutionControl.H"

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

namespace Foam

Class simpleControl Declaration
and the solutionControl.H has
#include "fvMesh.H"

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

namespace Foam

Class solutionControl Declaration

I don't know why this compiler error appears, since both the namespace declarations are "as is" in the lnInclude directory.
How is it that both namespace Foam declarations are included to the meltFoam.c code. Isn't this a conflict to start out with?

Thanks for helping me out here.

KHoy is offline   Reply With Quote


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 07:24
CFX problem in ubuntu (linux) Vigneshramaero CFX 0 July 13, 2012 10:22
CFX-Pre problem, pls help!!! cth_yao CFX 0 February 17, 2012 01:52
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21
CFX Post: Problem with Macro Shafiul CFX 12 January 5, 2011 16:24

All times are GMT -4. The time now is 03:25.