• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:00
CET 14:00
KST 22:00
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced14[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband BGE Stara Zagora 2026 announced Information Request Regarding Chinese Ladder SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
$5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
FlaSh's Valkyrie Copium Which season is the best in ASL? [ASL20] Ask the mapmakers — Drop your questions BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread Should offensive tower rushing be viable in RTS games? The Perfect Game
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1231 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
Wardi Open
12:00
Qualifier #3
WardiTV649
IndyStarCraft 90
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko210
SortOf 163
ProTech115
IndyStarCraft 90
StarCraft: Brood War
Britney 44661
Calm 5142
Horang2 1620
Shuttle 1375
PianO 887
EffOrt 831
BeSt 807
Stork 744
Hyuk 584
Mini 459
[ Show more ]
firebathero 437
Larva 333
Soma 265
Light 196
Leta 148
Snow 131
ZerO 117
ggaemo 111
Soulkey 107
Killer 95
Pusan 93
Mong 89
Rush 88
Dewaltoss 78
hero 77
Barracks 67
Sea.KH 60
JYJ46
JulyZerg 41
Aegong 38
Backho 37
Shinee 36
Movie 29
Icarus 28
Yoon 28
NaDa 24
soO 20
zelot 19
scan(afreeca) 19
yabsab 16
ajuk12(nOOB) 15
Terrorterran 13
Sacsri 12
HiyA 12
Shine 9
ivOry 3
Dota 2
XcaliburYe260
Counter-Strike
olofmeister2389
byalli417
edward55
Other Games
B2W.Neo1068
Fuzer 244
Mew2King100
KnowMe100
QueenE46
ZerO(Twitch)13
Organizations
StarCraft: Brood War
lovetv 6
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV496
League of Legends
• Jankos1620
Upcoming Events
StarCraft2.fi
4h
PiGosaur Monday
12h
Wardi Open
23h
StarCraft2.fi
1d 4h
Replay Cast
1d 11h
The PondCast
1d 21h
Replay Cast
2 days
Korean StarCraft League
3 days
CranKy Ducklings
3 days
SC Evo League
3 days
[ Show More ]
BSL 21
4 days
Sziky vs OyAji
Gypsy vs eOnzErG
Sparkling Tuna Cup
4 days
BSL 21
5 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
5 days
Wardi Open
5 days
StarCraft2.fi
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-11-28
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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.