CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

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

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2021, 09:47
Question Can't use "const fvMesh& mesh" in custom class?
  #1
Senior Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14
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:

Code:
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?

Code:
protected:
        //- 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

Reply

Tags
constant reference, fvmesh


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 03:21
The udf.h headers are unable to open- in VISUAL STUDIO 13 sanjeetlimbu Fluent UDF and Scheme Programming 4 May 2, 2016 06:38
Possible bug in OpenFoam Interpolation class MMC15 OpenFOAM Bugs 2 March 23, 2014 13:55
Nested class and inheritance permissions MMC15 OpenFOAM Programming & Development 0 December 20, 2013 11:16
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 21:30


All times are GMT -4. The time now is 01:05.