Thread: Getting Errors when calling pModel (Model Loading again)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968

    Getting Errors when calling pModel (Model Loading again)

    Okay, so I declared the pointer extern in MS3D.H and wrote it in the .cpp file the way its spose to be, I add the header file MS3D.H to my main cpp file, the only problem is, when i call the pointer it does this.


    I call pModel like this

    Code:
    	pModel = new MS3DModel();
    	if ( pModel->LoadModelData( "data/model.ms3d" ) == false )
    	{
    		MessageBox( NULL, "Couldn't load the model data/model.ms3d", "Error", MB_OK | MB_ICONERROR );
    		return 0;									// If Model Didn't Load, Quit
    	}
    Code:
    --------------------Configuration: NeHeGL - Win32 Debug--------------------
    Compiling...
    Example.cpp
    C:\Documents and Settings\colemanjon\Desktop\RenderEngine\Example.cpp(27) : error C2501: 'pModel' : missing storage-class or type specifiers
    C:\Documents and Settings\colemanjon\Desktop\RenderEngine\Example.cpp(27) : error C2040: 'pModel' : 'int' differs in levels of indirection from 'class MS3DModel *'
    C:\Documents and Settings\colemanjon\Desktop\RenderEngine\Example.cpp(27) : error C2440: 'initializing' : cannot convert from 'class MS3DModel *' to 'int'
            This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\Documents and Settings\colemanjon\Desktop\RenderEngine\Example.cpp(28) : error C2143: syntax error : missing ';' before 'if'
    C:\Documents and Settings\colemanjon\Desktop\RenderEngine\Example.cpp(29) : error C2143: syntax error : missing ';' before '{'
    C:\Documents and Settings\colemanjon\Desktop\RenderEngine\Example.cpp(29) : error C2447: missing function header (old-style formal list?)
    Error executing cl.exe.
    Creating browse info file...
    
    NeHeGL.exe - 6 error(s), 0 warning(s)
    I'll attach necessary files..
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    is pModel declared as a MS3DModel?

    Sorry for the stupid question but I can't figure out what it could be.

  3. #3
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    I declare it like this

    Code:
    MS3DModel *pModel = NULL;
    and call it like the first post
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Code:
    	pModel = new MS3DModel();
    	if ( pModel->LoadModelData( "data/model.ms3d" ) == false )
    	{
    		MessageBox( NULL, "Couldn't load the model data/model.ms3d", "Error", MB_OK | MB_ICONERROR );
    		return 0;									// If Model Didn't Load, Quit
    	}
    Why do you have that bit of code just floating in the global namespace like that? Put it in a function where it belongs.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    yeah yeah, i know, im just putting it there so i know its not hiding under anything and missing the declaration, its being a pain, i'd normally have it in the winmain section..
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Quote Originally Posted by Shamino
    yeah yeah, i know, im just putting it there so i know its not hiding under anything and missing the declaration, its being a pain, i'd normally have it in the winmain section..
    No, I mean that's why you are getting the errors.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. multiple file loading. so fruturated! help!
    By psychopath in forum Game Programming
    Replies: 5
    Last Post: 05-09-2005, 05:13 PM
  2. Errors calling function
    By nizbit in forum C Programming
    Replies: 4
    Last Post: 02-16-2005, 06:35 PM
  3. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  4. need help with .md3 file loading
    By Shadow12345 in forum Game Programming
    Replies: 2
    Last Post: 12-06-2002, 04:06 PM
  5. how to check for errors
    By Shadow in forum C Programming
    Replies: 3
    Last Post: 10-04-2001, 06:27 PM