PDA

View Full Version : some problem with Xcode




quanganhct
Jun 11, 2011, 07:33 PM
Hello,

I have a problem when compiling a project in Xcode. Well that's an exercise about OOP, and my mission is to implement the functions missed in that project.

When I compile by Xcode, there was alot errors appeared, but when I use Makefile, then it's a piece of cake.

I wonder why, using Xcode cannot do but using Makefile can.

Someone please help me.

PS: I upload my project, with the Makefile included.



jiminaus
Jun 11, 2011, 10:05 PM
Because Pile.cxx, where all the compiler errors are, isn't involved in the Makefile.

EDIT:
Oh, now I've looked closer at the code, I see main.cc includes Pile.h which includes Pile.cxx. So the problem is actually that XCode is trying to compile Pile.cxx by itself. You need to exclude Pile.cxx from the build.

To do this in XCode 4:

Select the project at the top of the tree on the left-hand side of the XCode window.
Select the ProjectMAC target.
Select the Build Phases tab.
Expand the Compile Sources build phase.
Select Pile.cxx
Click the remove (-) button

quanganhct
Jun 11, 2011, 11:49 PM
Because Pile.cxx, where all the compiler errors are, isn't involved in the Makefile.

EDIT:
Oh, now I've looked closer at the code, I see main.cc includes Pile.h which includes Pile.cxx. So the problem is actually that XCode is trying to compile Pile.cxx by itself. You need to exclude Pile.cxx from the build.

To do this in XCode 4:

Select the project at the top of the tree on the left-hand side of the XCode window.
Select the ProjectMAC target.
Select the Build Phases tab.
Expand the Compile Sources build phase.
Select Pile.cxx
Click the remove (-) button


But I use Xcode 3, is there anyway to handle it ?

jiminaus
Jun 11, 2011, 11:57 PM
But I use Xcode 3, is there anyway to handle it ?

You didn't specify which XCode you were using, so I just assumed you were using the same as me.

I don't have XCode 3 so I can't confirm this, but Fritz Anderson's XCode 3 Unleashed book says to:


Expand Targets
Expand the ProjectMAC target
Expand Compile Sources
Remove Pile.cxx

quanganhct
Jun 12, 2011, 12:34 AM
You didn't specify which XCode you were using, so I just assumed you were using the same as me.

I don't have XCode 3 so I can't confirm this, but Fritz Anderson's XCode 3 Unleashed book says to:


Expand Targets
Expand the ProjectMAC target
Expand Compile Sources
Remove Pile.cxx


hooray !

It worked well . Thanks a lot :)