discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compilation error - first objective c program


From: patrick dudjalija
Subject: compilation error - first objective c program
Date: Sat, 12 Jan 2013 13:47:10 +0100

Hello everybody !

Referring to the Objective-C GNUstep Base Programming Manual, i'm trying to build the first example program (on page 8  section 1.5 building your first objective c program).
But i'm getting error messages. I documented the problem below.

Thanks a lot for any help !

Patrick

=====================================================================


1. The code : 
#include <stdio.h>
#include <Foundation/Foundation.h>

/*
 * Declare the Test class
 *
 */

@interface Test class
+(const char*) classStringValue;
@end

/* 
 * Implement Test class
 *
 */

@implementation Test class
+(const char*) classStringValue;
{
  return "This is the string of the Test Class";
}
@end


/*
 * main function
 *
 */

int main(void){
  printf("%s\n",[Test classStringValue]);
  return 0;
}

2. to make the file i'm using the commands (i'm running on openbsd 5.2 with ksh as shell) :

$ . /usr/local/share/GNUstep/Makefiles/GNUstep.sh 
$ gmake

i'm using the following GNUmakefile

include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = LogTest
LogTest_OBJC_FILES = source2.m
include $(GNUSTEP_MAKEFILES)/tool.make

3. I get the following error message

This is gnustep-make 2.6.2. Type 'gmake print-gnustep-make-help' for help.
Running in gnustep-make version 2 strict mode.
Making all for tool LogTest...
 Compiling file source2.m ...
source2.m:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '+' token
source2.m:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '+' token
gmake[3]: *** [obj/LogTest.obj/source2.m.o] Error 1
gmake[2]: *** [internal-tool-all_] Error 2
gmake[1]: *** [LogTest.all.tool.variables] Error 2
gmake: *** [internal-all] Error 2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]