Game Development Community

Map2dif Xcode compile

by Richard Brak · in Torque Game Engine · 06/17/2005 (4:48 pm) · 14 replies

Hi Folks,
Has anyone had any luck getting map2dif to compile using Xcode? I keep getting a linking error:

ld: Undefined symbols:
_main
__Z12VectorResizePjS_PPvjj
__Z13dFflushStdoutv
__Z4avarPKcz
__Z5dFreePv
__Z6dQsortPvjjPFiPKvS1_E


(plus a whole lot more symbols listed). any help would be appreciated.
thanks,
Richard.

About the author

Recent Threads


#1
06/17/2005 (5:50 pm)
That's odd, something's mangling the function symbols from their original names...

First off, what's missing is the Torque engine core. Map2Dif depends on it.
Second, have you got ZeroLink turned on on your map2dif target? You should probably turn it off, or things is gonna be rather slow.

Thrid: heres a project file with a working map2dif build I made a while back:
torqueAndMap2difProj.tgz
original thread here

this is an old version, which I havent updated in a while, so... there will be some missing files, some things you'll need to tweak... but it should give you a big leg up in any case ^^.

have fun!
#2
06/17/2005 (6:05 pm)
Hi Scott,
I just found you project (should have looked earlier!) - it has been a big help. At the moment I am having trouble with Xcode (2.1) and the paths for include files. I am not sure if you know how to sort this though. Xcode seems to search for the includes relative to the current file rather than with repsect to root of all the files in TGE. Thus if a file in the map2dif directory wants to include another map2dif file eg via

#include "map2dif/bspNode.h"

Xcode won't fid it - I have to change the line to

#include "bspNode.h"

before Xcode will find it. When I compile the Torque engine I don't have this problem, so I supstect it is something I have to set up with the new map2dif target?

thanks,
Richard.
#3
06/17/2005 (9:07 pm)
Hi Scott,
Well, eventualy gave up on my project, trying to get the paths correct, so switched to your project. All went well untill a pair of really weird errors:

/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransport.h:4253: error: declaration of 'operator new' as non-function

/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransport.h:4253: error: expected ';' before '(' token

I really don't have a clue as to how to fix them :(


Does anyone have a binary of map2dif to save me a bit of time?

thanks,
Richard.
#4
07/03/2005 (7:00 am)
Yeah.. that "operator new" thing is an old weirdness with Carbon. That one has been discussed a lot before, here in the mac forum.

As far as switching to my project, well, you probably need to add the needed include paths to your project before you give up on it. The header search paths are a real pain to get to in XCode native targets. Here's how you do it:
Double click the native target, under the Targets group in your project.
Click the Build tab.
You'll see a 2 column list. One of the column headers will be All Settings. Change it to Search Paths.
Beside the entry Header Search Paths, enter a space separated list of paths, either absolute or relative to the project file.

That'll get Xcode to find the headers.
#5
07/03/2005 (10:55 pm)
Hi Paul,
Managed to fix all the path problems - thanks. The "operator new" is still persisting tho (this is with gcc4). I have read through many of the past posts on the issue and tried some of the fixes - but no luck - none of them had exactly the same error message (ie the non-function part) tho:

/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransport.h:4253: error: declaration of 'operator new' as non-function
/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransport.h:4253: error: expected ';' before '(' token

so not sure if it is exactly the same thing.

many thanks,
Richard.
#6
08/12/2005 (7:15 pm)
Hi,

I came across this 'operator new' error while i was adding my custom header file to a TGE source file. I managed to get rid of this error by reordering header files in the .cc file, specifically, by placing my header file on top of the other header files. I don't know why this solves the problem though.
This might be completely wrong but it worked for me.

fyi, I'm using Xcode 2.0.
thanks,
So
#7
08/12/2005 (8:54 pm)
It's probably related to how Torque's memory manager overrides new. Moving your header ahead of the others is the correct solution. Hopefully. :)
#8
08/15/2005 (6:57 pm)
Ben's right. To clarify a bit:

Specifically, the OpenTransport.h header must be moved ahead of the other headers.
Including almost any of the Torque headers will include platform/platform.h, which both overloads operator new, and redefines new.

You can't use any code that overloads the global operator new, Torque's memory manager already does that.
You can't overload operator new on your class, unless you can put both the declaration AND the definition of your overloaded new before the inclusion of platform.h. Any code that doesn't use platform.h will be limited in what it can do, however.

So if you're overloading new, the best thing to do is to rethink your code, and find another way.

Most of the Mac compilation errors are just the OpenTransport.h thing though, so be sure that guy is at the top of the include list if you're having problems with Mac specific code.
#9
09/15/2005 (3:05 am)
Does somebody have a working build of Map2dif for OsX 3.9?
I tryed, but I just don't know anything about coding, and I couldn't get it working...

Thank you in advance,
Gustavo Muñoz
#10
02/02/2007 (8:37 pm)
Does anyone have an updated mac2dif xcode project? the one linked above leads to a 404. Thanks! (or even a binary would be more than enough - just something for os x)
#11
02/12/2007 (11:01 am)
This is a really ancient thread.
The xcode project distributed with TGE 1.4.2 and TGE 1.5.0 will build map2difplus, after a few really simple modifications. Updated build files will be sent out at some point. There are currently some stability and performance problems in map2dif.
#12
03/01/2007 (5:27 pm)
I'm teaching a course on game design and using Torque as the basis for the games. I've been trying to get map2difplus working on OSX so I can convert Blender map files into Torque dif files. I don't have easy access to a windows machine, and most everything else will run on the mac very nicely.

The xcode project for map2difplus needed significant modification--mostly adding files to the list of stuff to be compiled and setting up the header paths properly. The torque engine compiled with no problems. If there are some simple modifications to the map2difplus code that will make it work, please post them.

In map2difplus, in editGeometry.cc, a dynamic cast statement around line 715 was causing a bus error whenever the program ran. Changing it to a normal cast solved the bus error issue, but I don't know how it affected performance otherwise.

map2difplus will now run on some map files and produce appropriate structures, but on others (such as cottage_0.map in the starter.fps tree) it gives a bus error that occurs in bspNode.cc when it returns from the function, which implies some kind of memory issue with overwriting the stack. It's a difficult one to debug, not knowing the structure of the program. There aren't any obvious problems in the code that I can see. The bus error always occurs when there is a single winding, but having a single winding does not always cause a bus error.

The other thing occurring is that the lighting on the structures map2difplus creates is odd. Blocks that are textured identically, such as the top of the roof, are showing up with significantly varying intensities. Other parts of the structure are showing up with a green or reddish cast. It's not clear what the root cause of this issue might be. Any pointers would be appreciated.

Is there a functional OSX universal binary available for map2difplus, or even map2dif? If not, could someone provide some pointers on getting it working properly? Thanks.
#13
03/04/2007 (8:09 pm)
I have a working copy of map2difplus I built way back in Feb '06. I don't remember how I built it, but I definitely got it done. Would you like me to send you an email or a link to it?
#14
04/11/2007 (12:31 pm)
Um... "solving" that bus error by converting it to a static cast is probably trouncing memory somewhere.
That particular code looks like it would be affected by a different, otherwise unrelated bug related to portal entities, that was recently fixed.

Torque Constructor ships with a good build of map2difplus, and is free ( as in beer ).
TGE 1.5.1, which was released in conjunction with Constructor, also contains a map2dif project that will build.
Since you obviously aren't going to be modifying map2dif, I suggest using the compiled binary ( yes, it's universal ) that ships with Constructor.