Problem compiling since update
Problem compiling since update
- Subject: Problem compiling since update
- From: Alexander Hartner <email@hidden>
- Date: Thu, 7 Aug 2003 17:22:15 +0200
- Resent-date: Fri, 8 Aug 2003 08:41:48 +0200
- Resent-from: Alexander Hartner <email@hidden>
- Resent-message-id: <email@hidden .za>
- Resent-to: email@hidden
A few month back I wrote an application which transfers my Addressbook
into an LDAP. It used to compile file, although I think I might have a
memory leak somewhere, but this is not the problem. I had to make some
changes recently to the application on the java component, and
recompiled only to find a list of errors, which I never got before. I
think it might have got something to do with the GCC December upgrade
to a never version of GCC. On the other hand switching back to GCC 2.95
in Project Builder did not resolve this problem. I read on the web that
in compliance with ANSI-C I cannot combine a declaration and definition
in a single line as follows :
NSArray *people= [[ABAddressBook sharedAddressBook] people];
It just seems stange to me that it used to work fine, and now no longer
does. I am still new to ObjC so please ignore my ignorance if this is a
stupid question or mistake.
The errors which I get are the following :
-------------------START OF ERRORS-----------------------
...
CompileC
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/Objects-normal/ppc/main.o
/usr/bin/gcc2 -c
-F/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build
-I/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/include
-arch ppc -fno-common -fpascal-strings -O0 -Wmost
-Wno-four-char-constants -Wno-unknown-pragmas -pipe -g
-precomp-trustfile
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/TrustedPrecomps.txt
-Wp,-header-mapfile,/Users/alex/Projects/CVS_Repository/
AddressBook2Ldap/build/AddressBook2Ldap.build/AddressBook2Ldap.build/
AddressBook2Ldap.hmap -include
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/PrefixHeaders/
AddressBook2Ldap_Prefix.h main.m -o
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/Objects-normal/ppc/main.o
CompileC
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/Objects-normal/ppc/
AddressBook2LDAPController.o
/usr/bin/gcc2 -c
-F/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build
-I/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/include
-arch ppc -fno-common -fpascal-strings -O0 -Wmost
-Wno-four-char-constants -Wno-unknown-pragmas -pipe -g
-precomp-trustfile
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/TrustedPrecomps.txt
-Wp,-header-mapfile,/Users/alex/Projects/CVS_Repository/
AddressBook2Ldap/build/AddressBook2Ldap.build/AddressBook2Ldap.build/
AddressBook2Ldap.hmap -include
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/PrefixHeaders/
AddressBook2Ldap_Prefix.h AddressBook2LDAPController.m -o
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/Objects-normal/ppc/
AddressBook2LDAPController.o
AddressBook2LDAPController.m: In function `-[AddressBook2LDAPController
migrate:]':
AddressBook2LDAPController.m:12: parse error before `*'
AddressBook2LDAPController.m:13: `people' undeclared (first use in this
function)
AddressBook2LDAPController.m:13: (Each undeclared identifier is
reported only once
AddressBook2LDAPController.m:13: for each function it appears in.)
AddressBook2LDAPController.m:16: parse error before `*'
AddressBook2LDAPController.m:17: `jvm' undeclared (first use in this
function)
AddressBook2LDAPController.m:20: parse error before `connectorClass'
AddressBook2LDAPController.m:21: `connectorClass' undeclared (first use
in this function)
AddressBook2LDAPController.m:22: parse error before `connector'
AddressBook2LDAPController.m:27: `person' undeclared (first use in this
function)
AddressBook2LDAPController.m:27: `enumerator' undeclared (first use in
this function)
AddressBook2LDAPController.m:32: parse error before `*'
AddressBook2LDAPController.m:33: `surName' undeclared (first use in
this function)
AddressBook2LDAPController.m:35: parse error before `*'
AddressBook2LDAPController.m:37: `emails' undeclared (first use in this
function)
AddressBook2LDAPController.m:39: `email' undeclared (first use in this
function)
AddressBook2LDAPController.m:46: parse error before `*'
AddressBook2LDAPController.m:48: `phones' undeclared (first use in this
function)
AddressBook2LDAPController.m:50: `phone' undeclared (first use in this
function)
AddressBook2LDAPController.m:57: parse error before `*'
AddressBook2LDAPController.m:59: `currentPerson' undeclared (first use
in this function)
AddressBook2LDAPController.m:63: `connector' undeclared (first use in
this function)
...failed CompileC
/Users/alex/Projects/CVS_Repository/AddressBook2Ldap/build/
AddressBook2Ldap.build/AddressBook2Ldap.build/Objects-normal/ppc/
AddressBook2LDAPController.o ...
-------------------END OF ERRORS-----------------------
-------------------START OF LISTING-----------------------
#import "AddressBook2LDAPController.h"
#include <stdio.h>
#include <CoreFoundation/CFString.h>
@implementation AddressBook2LDAPController
- (IBAction)migrate:(id) sender
{
printf("Migrating \n");
[progressBar setDoubleValue:0];
NSArray *people= [[ABAddressBook sharedAddressBook] people];
[progressBar setMaxValue:[people count]];
printf("Processing %d people\n",[people count]);
NSJavaVirtualMachine *jvm = [NSJavaVirtualMachine
defaultVirtualMachine];
CFShow (jvm);
printf("CLASSPATH %s \n",[[NSJavaVirtualMachine defaultClassPath]
cString]);
[jvm initWithClassPath:@"Contents/Resources"];
id connectorClass =[jvm findClass:@"com.j2anywhere.ldap.Connector"];
CFShow (connectorClass);
id connector = [[connectorClass alloc] init];
NSEnumerator *enumerator = [people objectEnumerator];
ABPerson *person;
while ((person = [enumerator nextObject]) != nil)
{
NSString *firstName = [person valueForProperty:kABFirstNameProperty];
if (firstName == nil) firstName=@"";
NSString *surName = [person valueForProperty:kABLastNameProperty];
if (surName == nil) surName=@"";
NSString *email;
ABMultiValue *emails = [person valueForProperty:kABEmailProperty];
if ([emails count]!=0)
{
email = [emails valueAtIndex:0];
}
else
{
email = @"";
}
NSString *phone;
ABMultiValue *phones = [person valueForProperty:kABPhoneProperty];
if ([phones count]!=0)
{
phone = [phones valueAtIndex:0];
}
else
{
phone = @"";
}
NSString *currentPerson = [[firstName stringByAppendingString:@"
"]stringByAppendingString:surName];
printf("Migrating : %s (%s) (%s)\n",[currentPerson cString],[email
cString],[phone cString]);
[progressLabel setStringValue:currentPerson];
[progressBar setDoubleValue:[progressBar doubleValue]+1];
[connector addPersonToLDAP:firstName :surName :email :phone];
[progressBar setNeedsDisplay:YES];
[progressBar displayIfNeeded];
[progressLabel setNeedsDisplay:YES];
[progressLabel displayIfNeeded];
}
}
@end
-------------------END OF LISTING-----------------------
Thanks
Alex
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.