SDL OpenGL NeHe lessons problem

Hi,

I am relatively new to programming, especially C++, I have played around
with some of the SDL demos and currently creating a simple space invaders
game, just to get used to sdl and basic programming.

I have decided to look into opengl for my next basic project, and have
recently downloaded the sdl (nehe converted) opengl lessons.

Unfortunately I am having trouble compiling some of them, well at least
lessons 6,7,8.

The errors are: (lesson 6) though the other lessons fail with the same
error.

line 41: implicit declaration of function 'int malloc(…)'
tmpbuf = (Uint8 *)malloc(image->pitch);
line 63: implicit declaration of function 'int free(…)'
free(tmpbuf);

I am using Dev-C++ 4.9.5.0 as editor and using its default compiler, I have
not had other problems with the lessons upto 6.

Any help to get these lessons to run would be most appreciated.

If you require any more information, I will be willing to answer to the best
of my abilities.

Cheers

Regards

Matthew Cooper

Hi,

Sorry, found my own solution. I went through some other demos, not the SDL
ones.

I tried just pasting various #includes into the project. It was missing the
following include file:

#include <stdlib.h>

This has solved the problem I was getting.

Matthew Cooper> ----- Original Message -----

From: Matthew Cooper [mailto:@Matthew_Cooper]
Sent: Tuesday, August 27, 2002 3:20 PM
To: 'sdl at libsdl.org
Subject: [SDL] SDL OpenGL NeHe lessons problem

Hi,

I am relatively new to programming, especially C++, I have played around
with some of the SDL demos and currently creating a simple space invaders
game, just to get used to sdl and basic programming.

I have decided to look into opengl for my next basic project, and have
recently downloaded the sdl (nehe converted) opengl lessons.

Unfortunately I am having trouble compiling some of them, well at least
lessons 6,7,8.

The errors are: (lesson 6) though the other lessons fail with the same
error.

line 41: implicit declaration of function 'int malloc(…)'
tmpbuf = (Uint8 *)malloc(image->pitch);
line 63: implicit declaration of function 'int free(…)'
free(tmpbuf);

I am using Dev-C++ 4.9.5.0 as editor and using its default compiler, I have
not had other problems with the lessons upto 6.

Any help to get these lessons to run would be most appreciated.

If you require any more information, I will be willing to answer to the best
of my abilities.

Cheers

Regards

Matthew Cooper


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

#include <memory.h>

hehehe (:

-Atrix> ----- Original Message -----

From: matthew.cooper@metrodata.co.uk (Matthew Cooper)
To:
Sent: Tuesday, August 27, 2002 7:19 AM
Subject: [SDL] SDL OpenGL NeHe lessons problem

Hi,

I am relatively new to programming, especially C++, I have played around
with some of the SDL demos and currently creating a simple space invaders
game, just to get used to sdl and basic programming.

I have decided to look into opengl for my next basic project, and have
recently downloaded the sdl (nehe converted) opengl lessons.

Unfortunately I am having trouble compiling some of them, well at least
lessons 6,7,8.

The errors are: (lesson 6) though the other lessons fail with the same
error.

line 41: implicit declaration of function 'int malloc(…)'
tmpbuf = (Uint8 *)malloc(image->pitch);
line 63: implicit declaration of function 'int free(…)'
free(tmpbuf);

I am using Dev-C++ 4.9.5.0 as editor and using its default compiler, I
have
not had other problems with the lessons upto 6.

Any help to get these lessons to run would be most appreciated.

If you require any more information, I will be willing to answer to the
best
of my abilities.

Cheers

Regards

Matthew Cooper


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,

Sorry, found my own solution. I went through some other demos, not the SDL
ones.

I tried just pasting various #includes into the project. It was missing the
following include file:

#include <stdlib.h>

This has solved the problem I was getting.

On Un*x systems, you can extract this information from SYNOPSIS section
of the appropriate manpage. E.g. if compiler complains about implicit
declaration of malloc, do “man malloc”.

latimeriusOn Tue, Aug 27, 2002 at 03:32:56PM +0100, Matthew Cooper wrote: