Game Development Community

Problem with redefinition of new iTGB 1.4, iPhone SDK 4.0 + OpenFeint - RESOLVED

by Seb Grinke · in iTorque 2D · 06/22/2010 (10:58 pm) · 4 replies

* Problem with redefinition of new *

Hi

I've switched over today after a hard drive crash forced my hand and Time Machine restored a version that would not compile (nice). I now have the latest iPhone SDK 4.0 and Torque 1.4, and I'm trying to compile my project which includes OpenFeint integration.

First I managed to get the sample building and running ok on my device after fiddling around with the Base SDK settings and switching GCC to 4.2.
My next step was to copy my whole project folder over, make the same changes and try to build. I'm now getting an error about the redefinition of new in iPhoneMemory.mm, which seems very odd as the code seems to #undef it before doing this. The code looks the same in the example that works. So I have some noob questions...

1. Have I missed a compiler/project setting or something else that will fix this?
2. Is this a totally stupid approach (possibly because the new version of Torque has new code at the project level which I need...?). Should I be creating a new project from scratch and copying my assets over before re-integrating OpenFeint instead?

Any help appreciated! (I'm really impressed with the community on here.)

Also just to let you guys know if you're submitting an update it looks like they may be going through slowly right now, mine has been in since June 18th and is still not being reviewed yet. I guess everyone is submitting new versions of their Apps for 4.0 and my guess is Apple are prioritizing based on number of users/IPad/4.0 support.

Thanks

Seb

Moderator - Moved out of bug section, as it is resolved and not a stock engine bug.

#1
06/23/2010 (1:39 am)
Seb, I haven't switched to 1.4 yet but I have compiled iWT with OF 2.4.5 and iOS4 - I also had the initial bunch of errors which disappeared after setting gcc to 4.2.

The fix for iPhoneMemory.mm was:

#ifdef new
#undef new
#endif

#ifndef TORQUE_DISABLE_MEMORY_MANAGER
void* FN_CDECL operator new(dsize_t dt, void* ptr)
{
   return (ptr);
}   
#else  
#include "new"  
#endif

Personally I'd create a new project in 1.4. and copy your stuff in piece by piece, but it does sound like you have more of an "engine" issue than a script issue. What happens if you don't make the fix to iPhoneMemory.mm - do you get the same error as originally described in the OF thread?

#2
06/23/2010 (8:56 am)
Thanks Scott - I forgot about the code changes I'd made on the engine side, which obviously get overwritten when you reinstall iTGB. It's running again now.
#3
06/25/2010 (5:04 am)
The latest GCC will rule out OS 2.x, but that's OK. You can set the minimum deployment to 3.1.3 when targetting older devices. The people who haven't upgraded are people you shouldn't care about anyway.
#4
06/28/2010 (10:56 am)
As a reminder, please use the Bug Reporting Standard. This makes easier for us to reproduce bugs and log them in our tracker.