Hi!
Yes, it is the objective-c keywords that are not recognized by the MW
compiler. When -- or if -- I manage to pass the compilation phase I
will start to deal with the runtime issue. (-:
Sample objective-c code (compiles with gcc main.m -o x -lobjc):
// --------------------------------------------------------
#include <objc/objc.h> //<objc/Object.h>
#include <stdio.h>
@[EMAIL PROTECTED]
SmallTest //: Object
- (const char *) description;
@[EMAIL PROTECTED]
SmallTest
- (const char *) description
{
return ("I program and therefore I am");
}
@[EMAIL PROTECTED]
main(int argc, const char *argv[])
{
SmallTest *obj = [SmallTest new];
printf ("%s\n", [obj description]);
return (0);
}
// --------------------------------------------------------
(I had to uncomment the inclusion of <objc/Object.h> because it uses
c++ keywords for message functions etc. The headers comes from the GCC
runtime.)
The code above fails with error:
Error: declaration syntax error
main.m line 4 @[EMAIL PROTECTED]
SmallTest //: Object
Error: declaration syntax error
main.m line 6 @[EMAIL PROTECTED]
Error: declaration syntax error
main.m line 13 @[EMAIL PROTECTED]
Error: undefined identifier 'SmallTest'
main.m line 17 SmallTest *obj = [SmallTest new];
Error: expression syntax error
main.m line 18 printf ("%s\n", [obj description]);
If I start with
#pragma objective_c on
the MW compiler reports the warning
Warning: illegal #pragma
main.m line 1 #pragma objective_c on
I noticed also another warning reported by mwcc, that's it using the
compiler from the command line:
### mwcc.exe Driver Warning:
# No file mapping matches 'main.m' (unrecognized file contents or
filename extension);treating as source text
..
..
..
Thus I wonder if I need to activate something like a "file mapping"? Or
is the Objective c feature is disabled on the x86 compiler?


|