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]
free() function
Which library use "int free(...) function"? For some reason, the compiler will refuse it. Here what it said:
#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 ]
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
double post due to server issue.
[edited by - Luya on January 3, 2003 5:45:28 PM]
[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 ]
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement