explicit type is missing

I have a header file and a cpp like this,
in the mesh::mesh_build I get the error explicit type is missing,how can I solve it?

Last edited on
Mesh_build() is a function. It needs a return type or if it doesn't return anything then the return type should be void

 
void Mesh_build(size_t Nnodes, size_t Nelms, VecVecDbl_t Coordinates, VecVecIdx_t Connectivities);


BTW, lines 20,30: fileName should be const reference rather than passing by value.
 
Mesh(const std::string & FileName);

Last edited on
Thanks for your answer, I guessed the same about both items you explained.
Thanks
@AbstractionAnon imagine I want to open one text file named mesh and obtain the size of connectivities, how it gonna be?
For example I can say something like this?
Mesh Global_Mesh(const std::string filename)
Global_Mesh.connectivities_.size()? I have one error in compiling here.
Last edited on
What's the error?

Line 14: Connectivities_ is capitalized.
In your question: Global_Mesh.connectivities_.size()? is not capitalized.

In code both of them are capitalized, it says expression must have a class type.
Please show the declaration for VecVecDbl_t.
1
2
typedef std::vector<double>             VecDbl_t;
typedef std::vector<VecDbl_t>           VecVecDbl_t;
Last edited on
1
2
3
4
// declare function that takes string parameter and returns a Mesh:
Mesh Global_Mesh(const std::string filename);

cout << Global_Mesh.connectivities_.size(); // error, Global_Mesh is name of a function 
you mean making Mesh(const std::string FileName); as a void function?
No. If you have line:
Mesh Global_Mesh( const std::string filename );
Then you do have a function declaration.

If you want to declare a variable 'Global_Mesh' and initialize it with value of existing variable 'filename', then you should have:
Mesh Global_Mesh( filename );
I have done this in my code but still I have the same error.
Is "expression must have a class type" the whole, exact error message? Compiler usually tells more than that.

We don't see enough of your code to even start to guess.
@resabzr Why have you deleted the code from your earlier posts? Please don't do that - it makes the thread incomprehensible for those looking to learn from it.
Sure.
Topic archived. No new replies allowed.