Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To -lobjc or not to -lobjc?

GCC manual says:

file.m
    Objective-C source code. Note that you must link with thelibobjc
    library yo make an Objective-C program work.

And:

-lobjc
    You need this special case of the-loption in order to link an
    Objective-C or Objective-C++ program.

However, I can succesfully compile a program with simply:

$ cc prg.m -framework Foundation

Is it a linker default, when you include a framework? If so, where is it documented? The program gets linked anyway:

$ otool -L a.out
a.out:
        /System/Library/Frameworks/Foundation.framework/.../Foundation (...)
        /usr/lib/libSystem.B.dylib (...)
    --> /usr/lib/libobjc.A.dylib (...)
        /System/Library/Frameworks/CoreFoundation.f...k/.../CoreFoundation (...)
like image 933
sidyll Avatar asked Sep 12 '11 12:09

sidyll


People also ask

What does Hamlet's To be or not to be mean?

The soliloquy is essentially all about life and death: "To be or not to be" means "To live or not to live" (or "To live or to die"). Hamlet discusses how painful and miserable human life is, and how death (specifically suicide) would be preferable, would it not be for the fearful uncertainty of what comes after death.

Did Shakespeare say to be or not to be?

"To be, or not to be" is the opening phrase of a soliloquy given by Prince Hamlet in the so-called "nunnery scene" of William Shakespeare's play Hamlet, Act 3, Scene 1.

What is the full quote of to be or not to be?

This quote from the play Hamlet, “To be, or not to be? That is the question—Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And, by opposing, end them?” The idea of whether is it better to live or to die.

What is the most famous soliloquy?

It is Shakespeare's most performed play around the world — and, of course, one of the most-taught works of literature in high school and college classrooms. In fact, Hamlet's “To be or not to be” speech is the best-known soliloquy in the world.


1 Answers

This is because the Foundation framework is already linked with libobjc.

So on OSX, you'll need -lobjc option only if you doesn't link with the Foundation framework (which is very rare).

like image 111
Macmade Avatar answered Sep 28 '22 11:09

Macmade