Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / September 2006



Tip: Looking for answers? Try searching our database.

[XCode 2.4] unable to create a deployment version

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Konni Scheller - 27 Sep 2006 19:17 GMT
Hi,

first, the debugging version links good. If I change to relase version,
lots of "multiple definition of symbols" errors appear (one for each
class I've defined) and the linking process stops.

Where's the bug? In XCode or in KonniCode?

Regards,
Konni

Signature

Grummelnd am Herd: http://www.roterochs.de/kulinarische-monologe/

Patrick Machielse - 27 Sep 2006 19:37 GMT
> first, the debugging version links good.

This is probably because the default setting for 'Debug' is to use
'ZeroLink'.

> If I change to relase version, lots of "multiple definition of symbols"
> errors appear (one for each class I've defined) and the linking process
> stops.
>
> Where's the bug? In XCode or in KonniCode?

Show us your code, and we'll tell you...

patrick
Konni Scheller - 28 Sep 2006 14:23 GMT
> This is probably because the default setting for 'Debug' is to use
> 'ZeroLink'.

What does 'ZeroLink' really do?

> Show us your code, and we'll tell you...

Voila...

File "Box.h"
       @class Editor;
       @class ChestType;
       @class Project;
       [..]

File "Box.m"
       #import "Box.h"
       #import "Editor.h"
       #import "ChestType.h"
       #import "Project.h"
       [..]

File "AppController.h"
       #import "Box.h"
       #import "Contact.h"
       [..]

File "AppController.m"
       #import "AppController.h"
       #import "printView.h"
       [..]

File "ChestType.h"
       @class Box;
       [..]

File "ChestType.m"
       #import "ChestType.h"
       [..]

File "Contact.h"
       #import "Person.h"     // Contact class extends class Person
       @class ProjectContacts;
       @class Project;
       @class Customer;
       [..]

File "Contact.m"
       #import "Contact.h"
       [..]

File "Customer.h"
       @class Contact;
       @class Project;
       [..]

File "Customer.m"
       #import "Customer.h"
       [..]

File "Editor.h"
       #import "Person.h"      // Person class extends class Person
       @class Box;
       [..]

File "Editor.m"
       #import "Editor.h"
       [..]

File "Person.h"
       [..]

File "Person.m"
       #import "Person.h"
       [..]

File "printView.h"
       [..]

File "printView.m"
       #import "printView.h"
       @class Box;
       [..]

File "Project.h"
       @class ProjectContacts;
       @class Box;
       @class Customer;
       [..]

File "Project.m"
       #import "Project.h"
       [..]

File "ProjectContacts.h"
       @class Contact;
       @class Project;
       [..]

File "ProjectContacts.m"
       #import "ProjectContacts.h"
       [..]

       
That produces the following Error:

/usr/bin/ld: multiple definitions of symbol .objc_class_name_Box
/usr/bin/ld: multiple definitions of symbol .objc_class_name_Customer
/usr/bin/ld: multiple definitions of symbol .objc_class_name_Contact
/usr/bin/ld: multiple definitions of symbol .objc_class_name_Project
/usr/bin/ld: multiple definitions of symbol .objc_class_name_Person
/usr/bin/ld: multiple definitions of symbol .objc_class_name_ChestType
collect2: ld returned 1 exit status

Well, that's it, the relevant part of the code as I think.

I can't figure out where's the big bug in this code.

Regards,
Konni

Signature

Grummelnd am Herd: http://www.roterochs.de/kulinarische-monologe/

Patrick Machielse - 28 Sep 2006 14:51 GMT
> > This is probably because the default setting for 'Debug' is to use
> > 'ZeroLink'.
>
> What does 'ZeroLink' really do?

It defers 'linking'/referencing symbols until runtime, making the build
time shorter. With today's fast machines it is generally prefered to
disable ZeroLink, since it has some side effects (you can not distribute
zerolinked binaries f.i.)

> > Show us your code, and we'll tell you...
>
> Voila...

Some strange things in here, not sure if they cause your problems or
not.

> File "ChestType.h"
>         @class Box;
[quoted text clipped - 3 lines]
>         #import "ChestType.h"
>         [..]

You need to #import "Box.h"; here as well

> File "printView.h"
>         [..]
[quoted text clipped - 3 lines]
>         @class Box;
>         [..]

It's not useful to use @class in an implementation file. This should be
an error I think, unless you don't use Box in your code at all.

patrick
Konni Scheller - 28 Sep 2006 19:51 GMT
> > What does 'ZeroLink' really do?
> It defers 'linking'/referencing symbols until runtime, making the build
> time shorter. With today's fast machines it is generally prefered to
> disable ZeroLink, since it has some side effects (you can not distribute
> zerolinked binaries f.i.)

That means, disable Zerolink at least for deplyoment versions, right?

> Some strange things in here, not sure if they cause your problems or
> not.

I thought the real stuff (the programm code) is not interesting; my
opinion was, that there is a problem with the dependicies of the files.

> It's not useful to use @class in an implementation file. This should be
> an error I think, unless you don't use Box in your code at all.

Yes, it was a typo. The @class is in the .h file.

After hours and hours I got a tip at the cocoa mailing list.

XCode is so comfortable to write the getter and setter methods for
managed object classes. When I was changing the data model, e.g. for the
class Box, I created these methods again. *) And XCode put this .m file
again into the "target compiled files" list. As I opened the list, I
found much of this files twice, and especially Box.m five times.

Deleting this multiple files solved the problem.

Konni

*) Click into the data model, choose "New File", and then "Managed
Object Class" and XCode will create the .h and .m files and link it to
the project.

Signature

Grummelnd am Herd: http://www.roterochs.de/kulinarische-monologe/

Patrick Machielse - 28 Sep 2006 20:07 GMT
> That means, disable Zerolink at least for deplyoment versions, right?

yes.

> As I opened the list, I found much of this files twice, and especially
> Box.m five times.
>
> Deleting this multiple files solved the problem.

Hmm, so the error compiler/linker message actually pointed to the
problem. Refreshing!

patrick
Konni Scheller - 28 Sep 2006 20:47 GMT
> Hmm, so the error compiler/linker message actually pointed to the
> problem. Refreshing!

Well, did *YOU* ever trust an error message...?

Konni
Signature

Grummelnd am Herd: http://www.roterochs.de/kulinarische-monologe/

Patrick Machielse - 28 Sep 2006 21:18 GMT
> > Hmm, so the error compiler/linker message actually pointed to the
> > problem. Refreshing!
>
> Well, did *YOU* ever trust an error message...?

No, that's exactly what's so refreshing ;-)

But let's not get carried away, it was probably a coincidence...

I don't know what it is about compiler messages. Any time I see a new
one, I just copy and paste it in Google, to see what on earth it may
mean...

p.
Michael Ash - 30 Sep 2006 03:32 GMT
>> Hmm, so the error compiler/linker message actually pointed to the
>> problem. Refreshing!
>
> Well, did *YOU* ever trust an error message...?

They always worked for me. The trouble is that they tell you exactly
what's wrong, not how to fix it. Much like the difference between the
computer doing what you tell it, and doing what you want.

Signature

Michael Ash
Rogue Amoeba Software

Michael Ash - 30 Sep 2006 03:32 GMT
>> > What does 'ZeroLink' really do?
>> It defers 'linking'/referencing symbols until runtime, making the build
[quoted text clipped - 3 lines]
>
> That means, disable Zerolink at least for deplyoment versions, right?

No, disable it for everything. ZL is evil and will hide many nasty bugs
until much, much later than you made them. It only gives you a noticeable
speed savings on truly gigantic projects. Why Apple turns it on by default
is a contuing mystery.

Signature

Michael Ash
Rogue Amoeba Software

Konni Scheller - 30 Sep 2006 10:27 GMT
> No, disable it for everything.

[x] Done.

> ZL is evil and will hide many nasty bugs
> until much, much later than you made them. It only gives you a
> noticeable speed savings on truly gigantic projects.

Ok, thanks.

Regards,
Konni

Signature

Grummelnd am Herd: http://www.roterochs.de/kulinarische-monologe/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.