Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » build problem(ld: unknown option: -o)
build problem [message #637607] Sun, 07 November 2010 18:50 Go to next message
Phani Srikar is currently offline Phani SrikarFriend
Messages: 3
Registered: November 2010
Junior Member
Hi,
I am kind of new at using Eclipse CDT4 on Mac, I am trying to compile and run a simple piece of C++ code on it, everything seems fine but I am constantly getting some error during the build process.

The error is in the following form:

ld: unknown option: -oCPP

where CPP is the project name. I know for sure that this problem is due to the loss of space between -o and CPP, but I am not able to find any option wherein I can edit it.

Can someone please help me out with this issue.

Thanks!
Phani Srikar Ganti
Re: build problem [message #637766 is a reply to message #637607] Mon, 08 November 2010 18:35 Go to previous messageGo to next message
David Bo Jensen is currently offline David Bo JensenFriend
Messages: 12
Registered: November 2010
Junior Member
Is it a make file project?
Do you have a file "Makefile" in the root of your project directory?
If so please paste us the contents (If it isn't too long)
Re: build problem [message #638349 is a reply to message #637607] Wed, 10 November 2010 23:01 Go to previous messageGo to next message
Phani Srikar is currently offline Phani SrikarFriend
Messages: 3
Registered: November 2010
Junior Member
Hello David,
Thanks for getting back to the post. Its not a makefile project. I've simply written two files one .cpp and other .h file. Whenever I try to build the project containing these two files it gives me a build error.

As a matter of fact, the files are working fine, I checked it by running them in terminal, its only that I want to get used to the Eclipse IDE environment, but I am basically not able to find the option where I can edit the format for compiling the code i.e give space between -o and the name. I am pretty much sure that it is the mistake.

Let me know if you have any idea of where I can edit these properties.

Thanks!
Phani Srikar Ganti
Re: build problem [message #638367 is a reply to message #638349] Thu, 11 November 2010 03:28 Go to previous messageGo to next message
Ethan Wessel is currently offline Ethan WesselFriend
Messages: 10
Registered: May 2010
Junior Member
I don't know if I understand your problem fully, but I'm going to go out on a limb and say that to edit the format for compiling the code, you might want to:

right click your project
go to the properties tab
go to C/C++ build and expand it (of course you can look around at the other tabs maybe the problem resides in one of them)
go to the settings
then click on the tool settings tab
a list will come up including C++ Linker, GCC Assembler, C++ Compiler, and C Compiler

perhaps your problem could be in there, preferably under the compiler since you want to, " find the option where [you] can edit the format for compiling the code"

I hope this helped, if not, my bad =/
Anyways Happy Coding. =)

-E
Re: build problem [message #638370 is a reply to message #637607] Thu, 11 November 2010 03:53 Go to previous messageGo to next message
Phani Srikar is currently offline Phani SrikarFriend
Messages: 3
Registered: November 2010
Junior Member
Hello Ethan,
Thanks for the reply. Actually, I already tried what you told me, but I couldn't understand the options in it.

The error which i'm getting is:

**** Build of configuration Debug for project CPP ****

**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -olinked_lists.o ../linked_lists.cpp
g++ -oCPP linked_lists.o
ld: unknown option: -oCPP

collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1784 ms.

If you look at the two lines i've highlighted, you can see the error in the format where there should be a space between -o and CPP, this is what i am looking for.


Thanks!
Phani Srikar Ganti
Re: build problem [message #638396 is a reply to message #638370] Thu, 11 November 2010 07:56 Go to previous messageGo to next message
Ethan Wessel is currently offline Ethan WesselFriend
Messages: 10
Registered: May 2010
Junior Member
I agree this is a problem... I also agree the options are confusing, I have yet to fully grasp then. In the mean time I'll do more research on what could be the problem. I am curious though if you're comfortable with sending me your simple program. I'll like to reproduce the error.

-E
Re: build problem [message #638653 is a reply to message #637607] Fri, 12 November 2010 00:38 Go to previous messageGo to next message
Rick  is currently offline Rick Friend
Messages: 3
Registered: November 2010
Junior Member
Hi, I just re-built a simple tester program on my linux system this is the linker output:
{
Building target: scratch_pad
Invoking: GCC C++ Linker
g++  -o"scratch_pad"  ./src/Cube.o ./src/Sphere.o ./src/scratch_pad.o   
Finished building target: scratch_pad
}


As you can see I get double-quotes. You can go here for the setup:
Project > Properties > C/C++ Build > Settings > Build Artifact
> Artifact Name [ ${ProjName} ]

and this is how it appears in the .project file:
.project: <name>scratch_pad</name>

So, you may have found a Mac problem. Hope this helps.
Re: build problem [message #643145 is a reply to message #637607] Sun, 05 December 2010 10:23 Go to previous messageGo to next message
Robert is currently offline RobertFriend
Messages: 1
Registered: December 2010
Junior Member
Hi,

sorry for just joining this discussion because i have a similar problem with Eclipse Helios Service Release for C/C++ Developers running on Mac OS X 10.6.
My gcc / g++ is version 4.2.

Trying to build the project test results in:
<everything ok before here, as on my mates eclipse on linux>
ld: unknown option: -otest
collect2: ld returned 1 exit status
make: *** [test] Error 1


With Ricks' Setup in Artifact Name i get this result:
<everything ok before here, as on my mates eclipse on linux>
ld: unknown option: -o[ ]
collect2: ld returned 1 exit status
make: *** [[ ]] Error 1


Does someone got an idea how to hack an whitespace in front of the project name in
Project > Properties > C/C++ Build > Settings > Build Artifact
> Artifact Name ?

The Problem does not appear on other(less complex) projects on my System. Tanks in advance..
Re: build problem [message #667104 is a reply to message #637607] Tue, 26 April 2011 18:17 Go to previous messageGo to next message
Fred  is currently offline Fred Friend
Messages: 1
Registered: April 2011
Junior Member
I had the same issue with Helios on MAC. Here is my fix...

Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Expert Settings: -> Command line pattern:

... add a space between "${OUTPUT_PREFIX} and ${OUTPUT}
icon4.gif  Re: build problem [message #669796 is a reply to message #667104] Wed, 11 May 2011 14:33 Go to previous message
Wesley Miller is currently offline Wesley MillerFriend
Messages: 4
Registered: May 2011
Junior Member
Likewise, I had the same issue with Helios on MAC. I tried Fred's fix, but it still didn't work. I had to surround my inserted space with quotes to prevent the output format from squishing out my inserted space.

Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Expert Settings: -> Command line pattern:

... add a " " between "${OUTPUT_PREFIX} and ${OUTPUT}

${OUTPUT_PREFIX}" "${OUTPUT}

Maybe there is some kind of space that isn't just a plain spacebar space?

Wes
Previous Topic:org.eclipse.ui.bindings
Next Topic:Context Sensitive Help for C++
Goto Forum:
  


Current Time: Fri Mar 29 14:50:16 GMT 2024

Powered by FUDForum. Page generated in 0.02985 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top