Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

quanganhct

macrumors member
Original poster
Dec 29, 2010
31
0
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.
 

Attachments

  • ProjectMAC.zip
    317.4 KB · Views: 41

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
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:
  1. Select the project at the top of the tree on the left-hand side of the XCode window.
  2. Select the ProjectMAC target.
  3. Select the Build Phases tab.
  4. Expand the Compile Sources build phase.
  5. Select Pile.cxx
  6. Click the remove (-) button
 
Last edited:

quanganhct

macrumors member
Original poster
Dec 29, 2010
31
0
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:
  1. Select the project at the top of the tree on the left-hand side of the XCode window.
  2. Select the ProjectMAC target.
  3. Select the Build Phases tab.
  4. Expand the Compile Sources build phase.
  5. Select Pile.cxx
  6. Click the remove (-) button

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

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
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:

  1. Expand Targets
  2. Expand the ProjectMAC target
  3. Expand Compile Sources
  4. Remove Pile.cxx
 

quanganhct

macrumors member
Original poster
Dec 29, 2010
31
0
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:

  1. Expand Targets
  2. Expand the ProjectMAC target
  3. Expand Compile Sources
  4. Remove Pile.cxx

hooray !

It worked well . Thanks a lot :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.