tags:

views:

643

answers:

3

Hello,

at the moment I try to port a Visual C++ application to Linux. The code compiles without errors in Visual Studio, but I get many compiler errors under Linux. One of these errors is:

../src/wktools4.cpp:29: error: no matching function for call to 'operator new(unsigned int, const char [40], int)'

More information:

  • IDE: kdevelop with G++
  • GUI API:

The error appears at the following line:

IMPLEMENT_APP(Cwktools4App)

and some more times.

What am I missing? Thanks,
/mspoerr

+1  A: 

It looks like your Visual C++ app has overloaded operator new().

This is often done (with the additional parameters you see) to add debugging and other analysis info to each memory allocation.

Since you get the error with something as simple as frame = new Cwktools4Frame; I recommend looking for macros or compiler-level defines that are redefining "new" as something else. The first place to look should be in debug-specific builds.

Shmoopty
I don't use an overloaded new operator. Maybe in some 3rd party lib (wxwidgets?) they do so. How can I find/resolve this?
mspoerr
Compile (gcc) the offending file again with a "-E" argument. That will output what the code looks like after the preprocessor runs its pass and all macros will be expanded.
Shmoopty
+1  A: 

I found the error:

#ifdef __WXDEBUG__
#define new WXDEBUG_NEW
#endif

When I remove this lines, I don't get the errors any more. The code was generated from a wxwidgets wizard for VisualStudio. I have no idea what it does...

Thank you all for your help! Now I have to fix the linker errors ;)

/mspoerr

mspoerr
A: 

Have you tried #include<new> ?

Qiqi Wang