The linker cannot find the libraries (do they exist?)

Joined
Nov 1, 2009
Messages
16
Reaction score
0
Points
1
I am a new Mac OS user, and I have problems building my programs. At the beginning the compiler was not found. I set the paths in ".profile", and that problem has been solved. Now the linker gives me errors such as:

error: iostream: No such file or directory

If I do not include *any* file (in a simple test program), I get:

ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status

I suppose I did not install everything needed, but when I installed MacOS X 10.6 with XCode I just followed what indicated...

Thank you for any help,

Pietro

MacBook Pro 17" (2009)
MacOS X 10.6
gcc 4.2

Source code:

Code:
#include <iostream>
int main()
{
    std::cout << "Hello world!" << std::endl;
    return 0;
}
 
Joined
May 2, 2009
Messages
480
Reaction score
13
Points
18
Your Mac's Specs
MBP 2.33 4GB: MacPro 8 Core 2.8, 16GB: MacMini 2.26 4GB: MacMin 2.53 4GB: iPhone3GS 32GB
Hi, welcome to the forums.

What type of project did you setup in XCode for the code you listed above? For C++ projects you should have chosen Command Line Tool->C++ std c++. It looks like you may not have created the correct project which in turn would prevent XCode from linking against the correct libraries.
 
OP
P
Joined
Nov 1, 2009
Messages
16
Reaction score
0
Points
1
In Xcode I have not been able to find: Command Line Tool->C++ std c++.
When I create a new project, all I can choose from is a generic empty project. Then looking at the project info I could see no such options...

I think the problem might not be Xcode, because I also have similar troubles working from the command line or from other IDEs (CodeBlocks). But I might be wrong.
 
OP
P
Joined
Nov 1, 2009
Messages
16
Reaction score
0
Points
1
Can anyone let me know how to link to my object code to the libraries? Do I have to specify the libraries' paths on a .config file or similar?
If you can tell me where I can find a good online tutorial to develop on MacOS X, it will be useful.
Thank you for your help.
 
Joined
May 2, 2009
Messages
480
Reaction score
13
Points
18
Your Mac's Specs
MBP 2.33 4GB: MacPro 8 Core 2.8, 16GB: MacMini 2.26 4GB: MacMin 2.53 4GB: iPhone3GS 32GB
In Xcode I have not been able to find: Command Line Tool->C++ std c++.

This is ultimately the problem. From the sound of it, you do not have XCode installed correctly. The Command line project templates come with the IDE by default. I would recommend uninstalling and reinstalling the IDE.

Can anyone let me know how to link to my object code to the libraries?

This is what XCode does for you and should not require any action on your part. Again, I would recommend getting your environment up and running correctly before you do anything else.

If you can tell me where I can find a good online tutorial to develop on MacOS X, it will be useful.

This is a good place to start:

Cocoa Dev Central
 
OP
P
Joined
Nov 1, 2009
Messages
16
Reaction score
0
Points
1
I solved the problem just reinstalling Xcode. Now I can compile from the command line, from the GUI, ... I can even use QtCreator.
Thank you wmprice1240!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top