|
From: Joseph, B. & E. V. <bl...@ho...> - 2001-09-15 22:37:52
|
Hello all,
This is my first post to this list. My name is Joseph, you can call =
me Blumojo (or "blu" or "mojo" for short). I really like Dev-cpp and am =
thinking of sending a donation if I can get the following to work. I am =
working on NeHe's OpenGL tutorials (http://nehe.gamedev.net/) which are =
really good - even for a novice like me, but the code he gave was for =
Visual CPP. I have worked through a couple of the problems, but have =
become "stumped" on lesson 7 where the compiler has given me:
"implicit declaration of function int free()"
In his explanation, this function is used to free memory used to store =
texture data.
First of all, has anyone worked through these tutorials and ported =
them to Dev-CPP/MinGW? If so, I would greatly appreciate the code to =
help me along. Second, is there another (perhaps better) way to free =
this memory?
Thank you all so much for the help!
-Bumojo
|
|
From: tomasino <tom...@ho...> - 2003-01-15 16:20:56
|
When I try to debug a proyect it shows me: "You need to put debugging mode on before debugging". Please help me on this. I'm cuban, forgive my English. Thanks. |
|
From: tomasino <tom...@ho...> - 2003-01-15 16:34:23
|
When I try to debug a proyect it shows me: "You need to put debugging mode on before debugging". Please help me on this. I'm cuban, forgive my English. Thanks. |
|
From: Ravi G. <bri...@gm...> - 2009-05-19 19:42:19
|
Hello,
I am new to this list and I would like to introduce myself. My name
is Ravi Gehlot and I am a junior Computer Science student at the
University of Central Florida.
Ravi.
|
|
From: Jason H. <jas...@bt...> - 2001-09-15 23:42:07
|
I'm afraid I can't offer you much help with OpenGL and those tutorials, =
but I do know something about "free()".
When programming in C you use free() allong with malloc() to dynamically =
create and *free* up memory. If you want to learn more about dynamic =
allocation you should read a good C/C++ book. Any C book should explain =
more about malloc() and free().
From what you have said it sounds like you need to include <stdlib.h>, =
which is where those functions are declared. If it is already defined =
then the problem is elsewhere.
As for alternatives... if you are using C++ (as aposed to pure C) then =
you can use the dynamic allocation functions that are part of the C++ =
language, which are new() and delete(). Again any good C++ book will =
explain these. Using malloc() and free() is still valid in C++ (and you =
can use the header <cstdlib> instead of <stdlib.h>), but new() and =
delete() are better because of the way they are designed to handle =
pointers and datatypes as part of the language.
i.e.
int *p;
p =3D new int[10]; // create an int array
for(int i=3D0; i<10; ++i)
p[i] =3D i*i; // fill array with square of 0 through to 9.
for(int i=3D0; i<10; ++i)
cout << p[i] << endl; // display contents of dynamic array.
// don't forget need to include <iostream> to use cout etc...
delete p; // always free up memory or you will get a memory leak!!!
...
This is just a quickie I created off the top of my head, so it probably =
won't work ;-) I'm too lazy to actualy test it.
p =3D new int[10];
is the same as
p =3D (int*) malloc(10*sizeof(int));
in C.
delete p;
is the same as
free(p);
in C.
Just remember you cannot use one malloc() with delete() and new() with =
free().... they don't mix.
Hope this helps, and anyone else feel free to point out any mistakes I =
may have made.
Jason.
----- Original Message -----=20
From: Joseph, Brandi, & Elise VanPelt=20
To: dev...@li...=20
Sent: Saturday, September 15, 2001 11:38 PM
Subject: [Dev-C++] Hello
Hello all,
This is my first post to this list. My name is Joseph, you can =
call me Blumojo (or "blu" or "mojo" for short). I really like Dev-cpp =
and am thinking of sending a donation if I can get the following to =
work. I am working on NeHe's OpenGL tutorials =
(http://nehe.gamedev.net/) which are really good - even for a novice =
like me, but the code he gave was for Visual CPP. I have worked through =
a couple of the problems, but have become "stumped" on lesson 7 where =
the compiler has given me:
"implicit declaration of function int free()"
In his explanation, this function is used to free memory used to store =
texture data.
First of all, has anyone worked through these tutorials and ported =
them to Dev-CPP/MinGW? If so, I would greatly appreciate the code to =
help me along. Second, is there another (perhaps better) way to free =
this memory?
Thank you all so much for the help!
-Bumojo
|
|
From: Ioannis V. <no...@ya...> - 2001-09-16 02:02:21
|
I write this because you said to point out the mistakes. :) =20 It is not new() and delete(), they are operators new and delete ( and new[] and delete[]). =20 Then in your code you do p=3Dnew int[10] and delete p; but it should be delete[] p; =20 Also new, new[], delete and delete[] are better because you can define what to do in memory allocation failure of new or new[] using set_new_handler() and overiding them to define where to place their objects (placement operators) in already allocated memory (even in the stack), which is a bit advanced topic. =20 =20 Regards, Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jason Hardman Sent: Sunday, September 16, 2001 1:42 AM To: dev...@li... Subject: Re: [Dev-C++] Hello I'm afraid I can't offer you much help with OpenGL and those tutorials, but I do know something about "free()". =20 When programming in C you use free() allong with malloc() to dynamically create and *free* up memory. If you want to learn more about dynamic allocation you should read a good C/C++ book. Any C book should explain more about malloc() and free(). =20 From what you have said it sounds like you need to include <stdlib.h>, which is where those functions are declared. If it is already defined then the problem is elsewhere. =20 As for alternatives... if you are using C++ (as aposed to pure C) then you can use the dynamic allocation functions that are part of the C++ language, which are new() and delete(). Again any good C++ book will explain these. Using malloc() and free() is still valid in C++ (and you can use the header <cstdlib> instead of <stdlib.h>), but new() and delete() are better because of the way they are designed to handle pointers and datatypes as part of the language. =20 i.e. =20 int *p; p =3D new int[10]; // create an int array =20 for(int i=3D0; i<10; ++i) p[i] =3D i*i; // fill array with square of 0 through to 9. =20 for(int i=3D0; i<10; ++i) cout << p[i] << endl; // display contents of dynamic array. // don't forget need to include <iostream> to use cout etc... =20 delete p; // always free up memory or you will get a memory leak!!! ... =20 This is just a quickie I created off the top of my head, so it probably won't work ;-) I'm too lazy to actualy test it. =20 p =3D new int[10]; =20 is the same as =20 p =3D (int*) malloc(10*sizeof(int)); =20 in C. =20 delete p; =20 is the same as =20 free(p); =20 in C. =20 Just remember you cannot use one malloc() with delete() and new() with free().... they don't mix. =20 Hope this helps, and anyone else feel free to point out any mistakes I may have made. =20 Jason. ----- Original Message -----=20 From: Joseph, <mailto:bl...@ho...> Brandi, & Elise VanPelt=20 To: dev...@li...=20 Sent: Saturday, September 15, 2001 11:38 PM Subject: [Dev-C++] Hello Hello all, This is my first post to this list. My name is Joseph, you can call me Blumojo (or "blu" or "mojo" for short). I really like Dev-cpp and am thinking of sending a donation if I can get the following to work. I am working on NeHe's OpenGL tutorials (http://nehe.gamedev.net/) which are really good - even for a novice like me, but the code he gave was for Visual CPP. I have worked through a couple of the problems, but have become "stumped" on lesson 7 where the compiler has given me: "implicit declaration of function int free()" In his explanation, this function is used to free memory used to store texture data. =20 First of all, has anyone worked through these tutorials and ported them to Dev-CPP/MinGW? If so, I would greatly appreciate the code to help me along. Second, is there another (perhaps better) way to free this memory? =20 Thank you all so much for the help! =20 -Bumojo |
|
From: Jason H. <jas...@bt...> - 2001-09-16 12:04:50
|
MessageThanks, I wrote about it of the top of my head, but not using = dynamic allocation of arrays all that often I forgot about the array = version. Only in recent weeks have I started coding again, so I'll = admitt I am a bit rusty, but it's just like riding a bike :) Any more mistakes anyone? Jason. ----- Original Message -----=20 From: Ioannis Vranos=20 To: dev...@li...=20 Sent: Sunday, September 16, 2001 4:03 AM Subject: RE: [Dev-C++] Hello I write this because you said to point out the mistakes. :) It is not new() and delete(), they are operators new and delete ( and = new[] and delete[]). Then in your code you do p=3Dnew int[10] and delete p; but it should = be delete[] p; Also new, new[], delete and delete[] are better because you can = define what to do in memory allocation failure of new or new[] using = set_new_handler() and overiding them to define where to place their = objects (placement operators) in already allocated memory (even in the = stack), which is a bit advanced topic. Regards, Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... = [mailto:dev...@li...] On Behalf Of Jason = Hardman Sent: Sunday, September 16, 2001 1:42 AM To: dev...@li... Subject: Re: [Dev-C++] Hello I'm afraid I can't offer you much help with OpenGL and those = tutorials, but I do know something about "free()". When programming in C you use free() allong with malloc() to = dynamically create and *free* up memory. If you want to learn more about = dynamic allocation you should read a good C/C++ book. Any C book should = explain more about malloc() and free(). From what you have said it sounds like you need to include = <stdlib.h>, which is where those functions are declared. If it is = already defined then the problem is elsewhere. As for alternatives... if you are using C++ (as aposed to pure C) = then you can use the dynamic allocation functions that are part of the = C++ language, which are new() and delete(). Again any good C++ book will = explain these. Using malloc() and free() is still valid in C++ (and you = can use the header <cstdlib> instead of <stdlib.h>), but new() and = delete() are better because of the way they are designed to handle = pointers and datatypes as part of the language. i.e. int *p; p =3D new int[10]; // create an int array for(int i=3D0; i<10; ++i) p[i] =3D i*i; // fill array with square of 0 through to 9. for(int i=3D0; i<10; ++i) cout << p[i] << endl; // display contents of dynamic array. // don't forget need to include <iostream> to use cout = etc... delete p; // always free up memory or you will get a memory leak!!! ... This is just a quickie I created off the top of my head, so it = probably won't work ;-) I'm too lazy to actualy test it. p =3D new int[10]; is the same as p =3D (int*) malloc(10*sizeof(int)); in C. delete p; is the same as free(p); in C. Just remember you cannot use one malloc() with delete() and new() = with free().... they don't mix. Hope this helps, and anyone else feel free to point out any mistakes = I may have made. Jason. ----- Original Message -----=20 From: Joseph, Brandi, & Elise VanPelt=20 To: dev...@li...=20 Sent: Saturday, September 15, 2001 11:38 PM Subject: [Dev-C++] Hello Hello all, This is my first post to this list. My name is Joseph, you = can call me Blumojo (or "blu" or "mojo" for short). I really like = Dev-cpp and am thinking of sending a donation if I can get the following = to work. I am working on NeHe's OpenGL tutorials = (http://nehe.gamedev.net/) which are really good - even for a novice = like me, but the code he gave was for Visual CPP. I have worked through = a couple of the problems, but have become "stumped" on lesson 7 where = the compiler has given me: "implicit declaration of function int free()" In his explanation, this function is used to free memory used to = store texture data. First of all, has anyone worked through these tutorials and = ported them to Dev-CPP/MinGW? If so, I would greatly appreciate the = code to help me along. Second, is there another (perhaps better) way to = free this memory? Thank you all so much for the help! -Bumojo |
|
From: St0fF 6. <st...@gm...> - 2001-09-16 00:17:56
|
Hi BluMo (What about this Variation?)!
I'm really sorry in advance because of what I can tell you 'bout devCPP =
and OpenGL examples. I'm a beginner to OpenGL and C++, too. My =
advantage: I've got a friend who's been doing this kind a codework for =
years. He uses GLUT and C++ on his MAC. So what I was doing is making =
his code work under windows. I tried devCPP long time and it nearly =
made me capitulate. Then I tried "JensFileEditor & GCC" and guess what: =
I didn't have to change more than replacing slashes in paths by =
backslashes and
{glutGameModeString(...); glutEnterGameMode();} by {glutFullScreen();} =
and it compiled and ran without any problems.
So I say I stick to the software that meets my needs. DevCPP is great =
in style and comfort, but for me it's rather useless. Sorry.
St0fF.
----- Original Message -----=20
From: Joseph, Brandi, & Elise VanPelt=20
To: dev...@li...=20
Sent: Sunday, September 16, 2001 12:38 AM
Subject: [Dev-C++] Hello
Hello all,
This is my first post to this list. My name is Joseph, you can =
call me Blumojo (or "blu" or "mojo" for short). I really like Dev-cpp =
and am thinking of sending a donation if I can get the following to =
work. I am working on NeHe's OpenGL tutorials =
(http://nehe.gamedev.net/) which are really good - even for a novice =
like me, but the code he gave was for Visual CPP. I have worked through =
a couple of the problems, but have become "stumped" on lesson 7 where =
the compiler has given me:
"implicit declaration of function int free()"
In his explanation, this function is used to free memory used to store =
texture data.
First of all, has anyone worked through these tutorials and ported =
them to Dev-CPP/MinGW? If so, I would greatly appreciate the code to =
help me along. Second, is there another (perhaps better) way to free =
this memory?
Thank you all so much for the help!
-Bumojo
|
|
From: Ioannis V. <no...@ya...> - 2001-09-16 01:53:19
|
void free(void *p) is defined in <stdlib.h> nd it ccan be used like
this.
=20
/* C program (.c) */
=20
#include <stdlib.h>
=20
int main()
{
int *p;
p=3Dmalloc(10*sizeof(int)); /* It creates an array of 10 integers on the
free store. */
p[0]=3D5;
p[3]=3D7;
/* ... */
=20
free(p); /* It deallocates the memory allocated for 10 integers */
=20
/* Now p points to nowhere, the array doesn't exist */
return 0;
}
=20
For C++ file (.cpp) you must use casting in malloc(), that is:
=20
p=3D(int *)malloc(10*sizeof(int));
=20
=20
but C++ provides more flexible mechanisms, new, new[], delete, and
delete[] so it becomes:
=20
p=3Dnew int[10];
p[0]=3D5;
p[3]=3D7;
// ...
delete[] p; =20
=20
=20
Ioannis
=20
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
<http://www.noicys.f2s.com/>=20
* Alternative URL: http://run.to/noicys
=20
=20
=20
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Joseph,
Brandi, & Elise VanPelt
Sent: Sunday, September 16, 2001 12:39 AM
To: dev...@li...
Subject: [Dev-C++] Hello
Hello all,
This is my first post to this list. My name is Joseph, you can call
me Blumojo (or "blu" or "mojo" for short). I really like Dev-cpp and am
thinking of sending a donation if I can get the following to work. I am
working on NeHe's OpenGL tutorials (http://nehe.gamedev.net/) which are
really good - even for a novice like me, but the code he gave was for
Visual CPP. I have worked through a couple of the problems, but have
become "stumped" on lesson 7 where the compiler has given me:
"implicit declaration of function int free()"
In his explanation, this function is used to free memory used to store
texture data.
=20
First of all, has anyone worked through these tutorials and ported
them to Dev-CPP/MinGW? If so, I would greatly appreciate the code to
help me along. Second, is there another (perhaps better) way to free
this memory?
=20
Thank you all so much for the help!
=20
-Bumojo
|
|
From: Jason <tux...@au...> - 2001-09-16 22:34:17
|
I am sorry if this is a stupid question but: How did you get the first =
one to work? Which one did you click on on the bottom of the various =
versions of the code? What kind of project type did you use? empty? =
Empty Window? Etc...
Thx in advance for your help
Jason=20
----- Original Message -----=20
From: Joseph, Brandi, & Elise VanPelt=20
To: dev...@li...=20
Sent: Saturday, September 15, 2001 5:38 PM
Subject: [Dev-C++] Hello
Hello all,
This is my first post to this list. My name is Joseph, you can =
call me Blumojo (or "blu" or "mojo" for short). I really like Dev-cpp =
and am thinking of sending a donation if I can get the following to =
work. I am working on NeHe's OpenGL tutorials =
(http://nehe.gamedev.net/) which are really good - even for a novice =
like me, but the code he gave was for Visual CPP. I have worked through =
a couple of the problems, but have become "stumped" on lesson 7 where =
the compiler has given me:
"implicit declaration of function int free()"
In his explanation, this function is used to free memory used to store =
texture data.
First of all, has anyone worked through these tutorials and ported =
them to Dev-CPP/MinGW? If so, I would greatly appreciate the code to =
help me along. Second, is there another (perhaps better) way to free =
this memory?
Thank you all so much for the help!
-Bumojo
|
|
From: Juliet <no...@li...> - 2001-10-05 16:54:14
|
At 18.38 15/09/2001 -0400, you wrote: > This is my first post to this list. My name is Joseph, you can call > me Blumojo (or "blu" or "mojo" for short). Welcome, mojo :) hope you enjoy your stay >I really like Dev-cpp and am thinking of sending a donation if I can get >the following to work. I am working on NeHe's OpenGL tutorials >(<http://nehe.gamedev.net/>http://nehe.gamedev.net/) which are really >good - even for a novice like me, but the code he gave was for Visual >CPP. I have worked through a couple of the problems, but have become >"stumped" on lesson 7 where the compiler has given me: >"implicit declaration of function int free()" C calling convention permits functions with an arbitrary number of parameters, since the parameters push AND pop is done on the caller side. Thus C code doesn't need prototypes for functions defined before they're called in the code. This is fine as long as you don't pass parameters of the wrong type (and if it happens the compiler won't warn you because of the lack of a prototype, you'll discover eventual type mismatches at runtime), and as long as you use the cdecl calling convention, that mangles function names by simply putting a "_" in front of them. Things can go ugly with stdcall convention, it mangles names as "_functionname@stacksize", so if you don't provide a prototype the compiler won't be able to generate the "@stacksize" part, the name will not match, the linking phase will fail, thanks for playing, game over. In short, you (they) forgot to include the file where free() is defined (try stdlib.h or malloc.h) AFAIK, malloc() and free() can be safely considered the best ways to allocate/free memory. On Windows, if you wish, you can use LocalAlloc/LocalFree, they map directly on malloc/free but providing for much more flexibility (initialization with zeros, moveable memory blocks, you can retrieve at any time the size of the buffer through its pointer, etc.), or HeapAlloc/HeapFree to allocate a bare block of heap (dangerous!), HeapCreate to create other heaps than the one allocated by default, or the powerful Virtual* family of functions if you're crazy enough to try to implement your own malloc/free. But, you see, these are very platform-dependent choices. You should be fine with the standard memory management |