PDA

View Full Version : Borland compiling errors with Maya's MType.h


imanobody
02-22-2004, 07:27 PM
OK, I'm kind of new to C++ and was just trying to make the simple helloWorld plugin for Maya to see if it would work. But when I try to compile it, with the Borland 5.5 compiler, it gives me errors for the MTypes header file. I'm probably doing something stupid, but I can't seem to find it.

Here's the source:

#include <maya/MSimple.h>
DeclareSimpleCommand( hello, "Alias|Wavefront", "4.0");
MStatus hello::doIt( const MArgList& args )
{
printf("Hello %s\n", args.asString( 0 ).asChar() );
return MS::kSuccess;
}

Here's the error Borland gives me:

C:\Borland\BCC55\Bin>bcc32 -ehelloworld.mll helloWorld.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
helloWorld.cpp:
Error E2176 c:\Borland\Bcc55\include\maya/MTypes.h 208: Too many types in declar
ation
Error E2176 c:\Borland\Bcc55\include\maya/MTypes.h 208: Too many types in declar
ation
Error E2146 c:\Borland\Bcc55\include\maya/MTypes.h 208: Need an identifier to de
clare
Error E2184 c:\Borland\Bcc55\include\maya/MTypes.h 212: Enum syntax error
Error E2040 c:\Borland\Bcc55\include\maya/MTypes.h 212: Declaration terminated i
ncorrectly
Error E2190 c:\Borland\Bcc55\include\maya/MTypes.h 212: Unexpected }
Error E2190 c:\Borland\Bcc55\include\maya/MTypes.h 212: Unexpected }
*** 7 errors in Compile ***

C:\Borland\BCC55\Bin>

Here's lines 207-213 of MTypes.h:

207: #ifndef _BOOL
208: typedef unsigned char bool;
209: #if !defined(true) && !defined(false)
210: #ifndef TRUE_AND_FALSE_DEFINED
211: #define TRUE_AND_FALSE_DEFINED
212: enum {false,true};
213: #endif // TRUE_AND_FALSE_DEFINED

Looks fine to me.:hmm:

I still want to write a bunch more console programs before I get into Maya's API, but I just thought I'd give it a go. I've been using Bloodshed, so it may just be me not knowing Borland's compiler.

Apoclypse
02-23-2004, 06:53 PM
I think you have to have Visual C++ for you to be able to compile a something in the Maya api. I don't think they let you use any other compiler.

imanobody
02-23-2004, 07:36 PM
In the manual, they do talk a lot of using builds for Visual C++, but I thought that they were only referencing to how they do it and you could use other compilers, if you felt like it.:shrug:

playmesumch00ns
02-23-2004, 07:38 PM
from my experience maya api is a bit fernickety. It can throw a wobbly between different versions of visual-c++. If you can get hold of a student copy I'd advise it, as it's the best compiler for windows anyway

gga
02-24-2004, 04:57 AM
Your problem is that Borland does not define the constant _BOOL automatically, but it does have the bool type (and most likely also has true/false).
That's why the code is failing. Pass a -D_BOOL into the compiler command line.
In terms of compilers, I know the maya api has been tested with vc6, vc6+intel compiler and vc7 (.net). vc7 also requires to define an iostream constant for it to compile fine (similar to linux).
I am unaware of anyone using borland, but it should be possible. You will just need to add some defines, like the above.

imanobody
02-24-2004, 03:08 PM
Thanks, I'll give it a shot and see what happens. I would just hate to spend a $100 on VC and find that I didn't need it. I've heard a lot of good stuff about VC, is it as good as everone says? They don't seem to have a demo so I can't test it out myself.

Apoclypse
02-24-2004, 04:50 PM
Oh wow i didn't know you could even use another compiler. I thought that since it only mentions VC++ that was all you can use. Well I'm gonna have a party now with Dev C++ and Maya ( I have visual c++ but it's just to slow and bloated for my taste, I like things as compact as possible).

FrankFirsching
02-24-2004, 07:30 PM
Maya plug-ins will only compile with the microsoft compiler (and the Intel compiler, which is binary compatible to vcc). The reason for this is, that every C++ compiler is using a different name mangling scheme. The name mangling determins how the arguments of a function will be embedded in its name. This is needed for function-overloading. Here are some examples of functions and their (simplified!) name mangled versions:
void foo(int x) foo_i
void foo(float y) foo_f
void foo(int x, float y) foo_i_f

Since the Maya libs are built with visual studio, you must use a compiler, whose name mangling is compatible with microsoft. This are namely vcc (from visual studio) and the intel compiler.

CGTalk Moderation
01-17-2006, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.