Results 1 to 7 of 7

Thread: Runtime error R6002?

  1. #1
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    25

    Runtime error R6002?

    Help! I'm writing a 3d file loader and I keep getting this error when I test my program:

    runtime error R6002
    -floating point not loaded

    What does this mean? How can I fix it?

    Here is the section of code that I think is causing this error:

    Code :
    typedef struct
    {
    	char		Name[16], Author[32], Info[256], *MatName;
    	float		Radius3do;
    	int			maxvert, maxtri, maxmesh, maxmat, *mat_w, *mat_h;
    	Mesh_t		*Mesh;
    }Model_t;
     
    Model_t	*Model;
    Model = (Model_t *) malloc(sizeof(Model_t));
     
    sscanf (readline, "RADIUS %f", &Model->Mesh[jcount].Radius);
    [This message has been edited by Zy (edited 05-19-2001).]

  2. #2
    Member Newbie
    Join Date
    Mar 2001
    Location
    .., ..., ...
    Posts
    31

    Re: Runtime error R6002?

    Did you allocate memory for Mesh?
    It does not matter who is right, when there is no one left!!!

  3. #3
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    25

    Re: Runtime error R6002?

    Doesn't Model = (Model_t *) malloc(sizeof(Model_t)); allocate memory for the mesh.

    The funny thing is that the whole program works when I leave a bunch of fprintf's (for program feedback) in the program. But when I comment some of them out, I start to get that error R6002 message and the program crashes.

  4. #4
    Guest

    Re: Runtime error R6002?

    no malloc does not allocate the memory for mesh. It just allocates the memory for a pointer to a mesh. (4 bytes) you have to created a new mesh yourself

  5. #5
    Member Newbie
    Join Date
    Dec 2000
    Posts
    44

    Re: Runtime error R6002?

    As far as R6002 goes I believe your compiler (VC?) optimized out the library (I think).

    Try adding a line like this early in the program

    float ignoreMe;
    ignoreMe = 123.456f;
    Any floating point number will do. The presence of a floating point number should force VC to link in the necssary library.
    ------------------
    Technically a pointer is not necessarily 4bytes because it will change depending on the model you've choosen to build with and the platform you're working on.
    ------------------
    From your structure it looks like memory also needs to be allocated for MatName, mat_w and mat_h in addition to Mesh after allocating for Model.
    You may want to create a function to do all the allocations and another function just to deallocate all the memory in reverse order to keep the code a little cleaner.


    [This message has been edited by Frumpy (edited 05-20-2001).]

  6. #6
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    25

    Re: Runtime error R6002?

    Does this really work?

    float ignoreMe;
    ignoreMe = 123.456f;

    Sounds strange that I have to fool VC++ to use the correct libraries.

    As for memory allocation for MatName, mat_w, and mat_h...yes I do allocate memory for these vars further in the code. I didn't list them because I was only getting errors with the Radius part.

  7. #7
    Member Newbie
    Join Date
    Dec 2000
    Posts
    44

    Re: Runtime error R6002?

    A long time ago I did once receive runtime error R6002 while loading data from a text file just as you've done and inserting those two lines of code solved the problem.

    You're giving VC a reason to link in the floating point library more than you are fooling VC.

Similar Threads

  1. Replies: 1
    Last Post: 09-24-2007, 04:02 AM
  2. Runtime Error
    By in forum OpenGL: User Software
    Replies: 3
    Last Post: 08-22-2003, 12:55 PM
  3. help -- runtime error
    By leo0801 in forum OpenGL: Linux
    Replies: 1
    Last Post: 02-07-2002, 07:30 AM
  4. glx runtime error
    By isajera in forum OpenGL: Linux
    Replies: 7
    Last Post: 06-06-2001, 02:12 PM
  5. Runtime error
    By in forum OpenGL: Linux
    Replies: 2
    Last Post: 02-11-2001, 06:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean