October 12, 2021, 08:47
|
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
|
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.
|
|
|