The closest topic to my question is here . I am trying to compile the following code with gcc:
#include <malloc.h>
class A
{
public:
A(){};
~A(){};
};
int main()
{
A* obj = (A*) malloc( sizeof(A) );
if(obj==0) return 1 ;
obj->A::A();
obj->A::~A();
free(obj);
return 0;
};
From the command line, I compile the code with:
$ g ++ -o main main.cpp
main.cpp: In function 'int main ()':
main.cpp: 22: error: invalid use of 'class A'
Could you point me in the right direction?
source
share