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

Can't use "const fvMesh& mesh" in custom class?

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

LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2021, 08:47
Question Can't use "const fvMesh& mesh" in custom class?
Senior Member
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 12
keepfit is on a distinguished road
Hi Foamers,

I created a custom class T that uses fvMesh as const reference member. However, when I call it in the main() function, after "createMesh.H" (mesh created), some error pops out:

T t(mesh); 

error: undefined reference to `Foam::T::T(Foam::fvMesh const&)'
I found out that in "fvMesh.H", the copy and assignment operation are disabled. In this case, how we can use "mesh" as const reference as a member of class?

        //- No copy construct
         fvMesh(const fvMesh&) = delete;
         //- No copy assignment
         void operator=(const fvMesh&) = delete;
Update: The problem is not on fvMesh, but with OpenFOAM's wmake: you have to include "*.cpp" file as well. Maybe alternative solution is to create my own class as an library.
keepfit is offline   Reply With Quote


constant reference, fvmesh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined reference to custom class cryabroad OpenFOAM Programming & Development 5 July 3, 2018 02:21
The udf.h headers are unable to open- in VISUAL STUDIO 13 sanjeetlimbu Fluent UDF and Scheme Programming 4 May 2, 2016 05:38
Possible bug in OpenFoam Interpolation class MMC15 OpenFOAM Bugs 2 March 23, 2014 12:55
Nested class and inheritance permissions MMC15 OpenFOAM Programming & Development 0 December 20, 2013 10:16
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30

All times are GMT -4. The time now is 07:28.