Advertisement

Frustrating Errors on compile

Started by March 10, 2003 10:26 PM
21 comments, last by adam17 21 years, 11 months ago
i keep getting the following errors when i try to build my prog. --------------------Configuration: OpenGL Window - Win32 Release-------------------- Compiling... import.cpp G:\Adam\Software\Visual C++\OGL Window 2\import.cpp(31) : error C2146: syntax error : missing '';'' before identifier ''MeshResize'' G:\Adam\Software\Visual C++\OGL Window 2\import.cpp(31) : error C2501: ''MESH'' : missing storage-class or type specifiers G:\Adam\Software\Visual C++\OGL Window 2\import.cpp(31) : fatal error C1004: unexpected end of file found main.cpp G:\Adam\Software\Visual C++\OGL Window 2\import.cpp(31) : error C2146: syntax error : missing '';'' before identifier ''MeshResize'' G:\Adam\Software\Visual C++\OGL Window 2\import.cpp(31) : error C2501: ''MESH'' : missing storage-class or type specifiers G:\Adam\Software\Visual C++\OGL Window 2\import.cpp(31) : fatal error C1004: unexpected end of file found Error executing cl.exe. OpenGL Window.exe - 6 error(s), 0 warning(s) the ''MESH'' thing is a struct with mesh properties inside ie vertices and normals. ''MeshResize'' is a function that resizes an array that holds the scene''s meshes. i have spent hours looking for the source of the problem but i havent gotten anywhere. can someone please help!?!
Post a bit of code?
Around line 31, say?
I like pie! - weebl.
Oneiric - Another graphics engine in the works.
Advertisement
Include the header that contains MESH and make sure it is really accessible by compiler
here is line 31, the one that keeps giving me errors. it is the beginning of a function which is defined in the header file.

MESH MeshResize(MESH array, int new_len)
{
MESH *new_array = NULL;

new_array = new MESH[new_len];

for(int x=0; x new_array[x] = array;

delete[] array;

return new_array;
}
if i comment out this function then the error moves down to the next function. here is the struct for MESH

struct MESH
{
int num_vertex,
num_faces,
num_t_vertex, //number of textured vertices
mat_id;
Vector3* vertex; //holds xyz values for vertices
Vector3* face; //holds 3 values for triangle vertices
Vector3* dir; //holds 3 values for winding polygon
Vector3* fnormal; //holds 3 values for face normals
Vector3* vnormal; //holds 3 values for vertex normals
};

if this doesnt help enough please tell me and i will post the entire file.
sorry my code is so messy i havent had a chance to clean it up much.

[edited by - adam17 on March 11, 2003 9:35:05 AM]

1. Where is MESH defined (filefilefile)
2. If it is a header file (.h) you have to #include it in all sources where you are using MESH
If it is a source file (.c/.cpp) copy it to the beginning of import.cpp (if it isn''t there)
3. MESH !MUST! be declared BEFORE any declarations that use it
4. When the compiler cannot find a type, he ignores the entire file (i think). So its normal that the errors moved down to the next func

If ive forgotten something please tell me



PM


times change


Excuse my poor english!
PM Times change... Excuse my poor english!
This error pops up every time you forget to close class with } bracket.

" Do we need us? "


Ionware Productions - Games and Game Tools Development

Advertisement
1. MESH is defined in the header file and is used in the .cpp file.
2. the .h file is included everywhere MESH is used. its two files. the header and source file. in the header everything in the source file is defined. at the top of the source file i have #include "import.h" (name of the file)
3. i have made sure that this is the way they are situated.
The compiler will also give this error when you have a /* left open in your code.
i checked for bad comments and its not the problem
Post the code before line 31 , 27 -30 should be good.

Also try line MESH test_variable;
begining of that file, so that you know for sure that MESH is included.

This topic is closed to new replies.

Advertisement