I have a .cc
file which uses both iostream
and malloc
. How can I compile that? using g++
, it says
error: 'malloc' was not declared in this scope
using gcc
, it says
fatal error: iostream: No such file or directory
The source code is located at http://sequitur.info/sequitur_simple.cc
UPDATE
I changed malloc
to new
and chaned free
to delete
. Still I get a lot of errors. For example
/usr/include/c++/4.6/new:103:14: error: initializing argument 2 of âvoid* operator new(std::size_t, void*)â [-fpermissive]
Answer
Either include
or include
and change malloc
to std::malloc
- compile with g++
. Including
is the prefered way for new C++ code, "name.h" style is deprecated in C++.
While this will fix you problem, it might be a better idea to migrate to new
/delete
, to be more consistantly C++.
No comments:
Post a Comment