CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   error: "namespace definition is not allowed here" (

meinenn October 24, 2012 10:55

error: "namespace definition is not allowed here"
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

gwierink October 24, 2012 17:16

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.

meinenn October 25, 2012 04:47

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...

All times are GMT -4. The time now is 04:33.