Advertisement

free() function

Started by January 03, 2003 04:20 PM
3 comments, last by Luya 22 years, 2 months ago
Which library use "int free(...) function"? For some reason, the compiler will refuse it. Here what it said:

89 C:\Dev-Cpp\C++ programs\sample\demo_cube.cpp
implicit declaration of function `int free(...)'
 
[edited by - Luya on January 3, 2003 5:23:09 PM]
#include <stdlib.h>

And only use it on pointers to memory allocated by malloc()-type functions.

In C++, use new and delete, or their array versions.


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
double post due to server issue.

[edited by - Luya on January 3, 2003 5:45:28 PM]
Thanks for the tip. It solved the problem. On Lesson 6, I noticed this function and assumed it was included in the C++ library. Maybe Nehe can edit his tutorials that use it since they are coded in C++.
The C library is part of the C++ library.
malloc and free are C memory management functions.

C++ has its own ''built-in'' memory managment operators.


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement