• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:39
CEST 19:39
KST 02:39
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
BGE Stara Zagora 2025: Info & Preview25Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN3The Memories We Share - Facing the Final(?) GSL46Code S RO12 Preview: Cure, Zoun, Solar, Creator4[ASL19] Finals Preview: Daunting Task30
Community News
[BSL20] ProLeague: Bracket Stage & Dates7GSL Ro4 and Finals moved to Sunday June 15th12Weekly Cups (May 27-June 1): ByuN goes back-to-back0EWC 2025 Regional Qualifier Results26Code S RO12 Results + RO8 Groups (2025 Season 2)3
StarCraft 2
General
The SCII GOAT: A statistical Evaluation Magnus Carlsen and Fabi review Clem's chess game. BGE Stara Zagora 2025: Info & Preview Jim claims he and Firefly were involved in match-fixing GSL Ro4 and Finals moved to Sunday June 15th
Tourneys
Bellum Gens Elite: Stara Zagora 2025 Master Swan Open (Global Bronze-Master 2) $5,100+ SEL Season 2 Championship (SC: Evo) SOOPer7s Showmatches 2025 Cheeseadelphia 2025 - Open Bracket LAN!
Strategy
[G] Darkgrid Layout Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 476 Charnel House Mutation # 475 Hard Target Mutation # 474 Futile Resistance Mutation # 473 Cold is the Void
Brood War
General
Will foreigners ever be able to challenge Koreans? BGH auto balance -> http://bghmmr.eu/ BW General Discussion I made an ASL quiz [BSL20] ProLeague: Bracket Stage & Dates
Tourneys
[ASL19] Grand Finals [Megathread] Daily Proleagues [BSL20] ProLeague Bracket Stage - Day 2 [BSL20] ProLeague Bracket Stage - Day 1
Strategy
I am doing this better than progamers do. [G] How to get started on ladder as a new Z player
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Nintendo Switch Thread Mechabellum
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
LiquidLegends to reintegrate into TL.net
Heroes of the Storm
Heroes of the Storm 2.0 Simple Questions, Simple Answers
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Vape Nation Thread European Politico-economics QA Mega-thread
Fan Clubs
Maru Fan Club Serral Fan Club
Media & Entertainment
Korean Music Discussion [Manga] One Piece
Sports
2024 - 2025 Football Thread Formula 1 Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Cleaning My Mechanical Keyboard
TL Community
The Automated Ban List
Blogs
Cognitive styles x game perf…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Poker
Nebuchad
Customize Sidebar...

Website Feedback

Closed Threads



Active: 8726 users

XCode Help

Blogs > SilverSkyLark
Post a Reply
SilverSkyLark
Profile Blog Joined April 2008
Philippines8437 Posts
November 14 2010 04:04 GMT
#1
Ok, I downloaded XCode 2.5 for Mac OS X 10.4 because I need it for my algorithm class. We are using C++ but since there's no DevC++ that works for Mac I had to download it.

It has a different interface than DevC++, and I can't seem to make .cpp files run on their own. So far I have this code for my sample.cpp:

#include <stdio.h>
#include <cmath>
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
cout << "Hi." << endl;
return 0;
}


I commented out #include <sample.h> because I forgot what to put there and how it works.

So I opened the thing that oversees the project, the window where you can see the .ccp and .h files along with a whole lot of things on the left side. I selected Build and Run but there's an outside code error:

Command/Developer/usr/bin/g++-4.0 failed with exit code 1



So, does anyone know how to work this code? Is there a way to make codes run by themselves? Like making them compile and run alone on as .cpp files like what you can do in Dev C++?

Uhm ok, I found that inside the Build Drop down menu, you have compile and from the window that opens (Build Results), you can run the code. I tried running the code but there's a problem, everything comes out well, along with the build and run log and a window opens. I guess the program is supposed to execute inside that Window but it's a white blank window.

Any ideas anyone? I think I found the way to make codes work but making them display the output it tricky. I'd really appreciate help.


"If i lost an arm, I would play w3." -IntoTheWow || "Member of Hyuk Hyuk Hyuk cafe. He's the next Jaedong, baby!"
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
November 14 2010 04:35 GMT
#2
Did you try to open the gdb window? Usually NSLog() outputs to there, probably the same for cout.
"When the geyser died, a probe came out" - SirJolt
zoombini
Profile Joined June 2010
United States67 Posts
November 14 2010 04:35 GMT
#3
In terminal, cd to the directory the cpp file is in.

If you want to use GNU C++ compiler,

g++ filename.cpp -o executable_name

To run:
./executable_name <arguments>
SilverSkyLark
Profile Blog Joined April 2008
Philippines8437 Posts
November 14 2010 04:41 GMT
#4
Sorry but how to you open the gdb window (what's gdb? sorry it's my first time working around this).

and I don't know how to open the terminal, it's not in the apple menu..
"If i lost an arm, I would play w3." -IntoTheWow || "Member of Hyuk Hyuk Hyuk cafe. He's the next Jaedong, baby!"
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
November 14 2010 04:50 GMT
#5
On November 14 2010 13:41 SilverSkyLark wrote:
Sorry but how to you open the gdb window (what's gdb? sorry it's my first time working around this).

and I don't know how to open the terminal, it's not in the apple menu..


gdb is the gnu debugger.

Usually when you compile and run your Xcode projects, a little bar pops up the coding area with some buttons. One of these buttons, which, if im not mistaken, has a terminal drawed on it, will open the gdb window.

Maybe compiling directly through the terminal is better. You find it on Applications -> Utility (not sure if its named Utility or System Tools, the Mac I am forced to use in the reasearch lab is in portuguese).
"When the geyser died, a probe came out" - SirJolt
inkblot
Profile Joined December 2004
United States1250 Posts
November 14 2010 04:54 GMT
#6
You may need to add a command to pause the program before it exits. Some IDEs add this automatically (depending on settings). Adding a getch() or something like that will force the program to wait before exiting.

Trying adding:
char c = getch();

between the cout line and return 0.

stdio should probably be included as <cstdio> as well, though it should work the way it is now.
Macavenger
Profile Blog Joined January 2008
United States1132 Posts
November 14 2010 04:57 GMT
#7
For simple assignments in an algorithms class, I'd strongly recommend just using GCC rather than trying to deal with any IDE. Just run it in the OS X Terminal as zoombini and fabiano said. It's in /Applications/Utilities.
SilverSkyLark
Profile Blog Joined April 2008
Philippines8437 Posts
Last Edited: 2010-11-14 05:06:37
November 14 2010 05:01 GMT
#8
I managed to open the terminal and get to open gdb by typing gdb in

ok more noob questions, how to I compile programs there? typed in help and I can't see anything that can specifically help me.


edit: I'll look for a gcc that would work in osx 10.4...if that doesn't give me anything, I'll borrow my dad's laptop and work there. thanks for the help guys..
"If i lost an arm, I would play w3." -IntoTheWow || "Member of Hyuk Hyuk Hyuk cafe. He's the next Jaedong, baby!"
zoombini
Profile Joined June 2010
United States67 Posts
November 14 2010 05:10 GMT
#9
GCC is the C compiler. G++ is the C++ compiler. They both should already be installed on your Mac OS X installation.

Like I said earlier, to compile your program
cd into the directory where the .cpp (or .cpp files are).

Type this into your terminal:
g++ your_cpp.cpp -o executable_name_you_want

If you have compile errors, it will tell you in terminal. If you do not get any errors, then you are golden.

If compile is successful, then type "ls" into terminal. This will list your current directory. If compile is successful, you will see executable_name_you_want listed. (Maybe type "ls | grep executable_name_you_want".)

To run the executable that you've compiled, type:
./executable_name_you_want

Your program should run.
Please log in or register to reply.
Live Events Refresh
CSO Contender
17:00
#42
CSOeSports20
Liquipedia
PSISTORM Gaming Misc
16:00
FSL Team Leag season 9 opener!
Freeedom17
Liquipedia
Fire Grow Cup
16:00
#10 - Group Stage
CranKy Ducklings105
MindelVK57
Liquipedia
Bellum Gens Elite
10:00
Stara Zagora 2025 Day 4
Clem vs Serral
Bellum Gens Elite4150
ComeBackTV 1645
TaKeTV 629
IndyStarCraft 408
3DClanTV 207
CosmosSc2 177
Rex142
EnkiAlexander 96
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Bellum Gens Elite4150
IndyStarCraft 408
Hui .375
CosmosSc2 177
Rex 142
ProTech104
MindelVK 57
StarCraft: Brood War
Britney 27977
Bisu 1590
Mini 1253
Jaedong 1169
Soulkey 385
Pusan 98
Hyun 54
Rock 37
soO 35
JYJ29
[ Show more ]
SilentControl 9
Dota 2
Gorgc7121
qojqva2865
LuMiX1
League of Legends
Dendi1334
JimRising 615
Counter-Strike
fl0m6758
olofmeister1480
rGuardiaN92
Super Smash Bros
Mew2King122
Heroes of the Storm
Liquid`Hasu304
Khaldor263
Other Games
tarik_tv48308
gofns31190
FrodaN1490
Beastyqt491
Lowko263
ArmadaUGS113
XaKoH 88
Trikslyr71
KnowMe59
White-Ra54
QueenE34
Organizations
Dota 2
PGL Dota 2 - Main Stream6120
PGL Dota 2 - Secondary Stream1682
Other Games
gamesdonequick639
BasetradeTV126
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• StrangeGG 77
• Adnapsc2 13
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• Ler95
League of Legends
• Nemesis2900
• Jankos1944
Other Games
• imaqtpie701
• Shiphtur258
Upcoming Events
BSL: ProLeague
21m
StRyKeR vs MadiNho
Cross vs UltrA
TT1 vs JDConan
Bonyth vs Sziky
Replay Cast
6h 21m
SOOP Global
9h 21m
Creator vs Rogue
Cure vs Classic
SOOP
15h 21m
Classic vs GuMiho
Sparkling Tuna Cup
16h 21m
AllThingsProtoss
17h 21m
Fire Grow Cup
21h 21m
BSL: ProLeague
1d
HBO vs Doodle
spx vs Tech
DragOn vs Hawk
Dewalt vs TerrOr
Replay Cast
1d 6h
Replay Cast
2 days
[ Show More ]
Replay Cast
2 days
WardiTV Invitational
2 days
WardiTV Invitational
2 days
GSL Code S
3 days
Rogue vs GuMiho
Maru vs Solar
Replay Cast
4 days
GSL Code S
4 days
herO vs TBD
Classic vs TBD
The PondCast
4 days
Replay Cast
5 days
GSL Code S
5 days
WardiTV Invitational
5 days
Korean StarCraft League
6 days
CranKy Ducklings
6 days
WardiTV Invitational
6 days
Cheesadelphia
6 days
Liquipedia Results

Completed

CSL Season 17: Qualifier 1
DreamHack Dallas 2025
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL Season 17: Qualifier 2
2025 GSL S2
BGE Stara Zagora 2025
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
ECL Season 49: Europe
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025
PGL Bucharest 2025
BLAST Open Spring 2025

Upcoming

CSL 17: 2025 SUMMER
Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
Murky Cup #2
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.