• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:52
CET 14:52
KST 22:52
  • 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
TL.net Map Contest #21: Winners10Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
StarCraft, SC2, HotS, WC3, Returning to Blizzcon!33$5,000+ WardiTV 2025 Championship6[BSL21] RO32 Group Stage4Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win10
StarCraft 2
General
Mech is the composition that needs teleportation t TL.net Map Contest #21: Winners Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win RotterdaM "Serral is the GOAT, and it's not close" 5.0.15 Patch Balance Hotfix (2025-10-8)
Tourneys
Constellation Cup - Main Event - Stellar Fest $5,000+ WardiTV 2025 Championship Sparkling Tuna Cup - Weekly Open Tournament Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection Mutation # 495 Rest In Peace
Brood War
General
[ASL20] Ask the mapmakers — Drop your questions BW General Discussion [BSL21] RO32 Group Stage BGH Auto Balance -> http://bghmmr.eu/ SnOw's ASL S20 Finals Review
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group B - Sunday 21:00 CET [BSL21] RO32 Group A - Saturday 21:00 CET
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile Should offensive tower rushing be viable in RTS games? Dawn of War IV
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread Dating: How's your luck?
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Why we need SC3
Hildegard
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1411 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
CranKy Ducklings
10:00
Sea Duckling Open #140
CranKy Ducklings79
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 198
Railgan 42
Creator 14
StarCraft: Brood War
Sea 6694
Horang2 4040
GuemChi 1668
Jaedong 862
actioN 292
Mini 259
BeSt 247
Killer 230
Soma 220
EffOrt 210
[ Show more ]
Rush 169
Mind 92
Hyun 87
Bonyth 72
ToSsGirL 69
Backho 61
sas.Sziky 33
JYJ28
PianO 27
zelot 24
Aegong 14
soO 12
Terrorterran 10
Sacsri 9
sorry 9
HiyA 8
Dota 2
Gorgc6041
singsing2210
qojqva1772
Dendi596
XcaliburYe214
BananaSlamJamma90
Heroes of the Storm
Khaldor209
Other Games
B2W.Neo1194
Lowko261
Sick244
Fuzer 193
Hui .112
XaKoH 95
nookyyy 54
MindelVK19
Organizations
StarCraft 2
WardiTV622
Counter-Strike
PGL242
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 67
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2050
League of Legends
• Stunt703
• HappyZerGling113
Upcoming Events
IPSL
4h 8m
dxtr13 vs OldBoy
Napoleon vs Doodle
LAN Event
4h 8m
Lambo vs Clem
Scarlett vs TriGGeR
ByuN vs TBD
Zoun vs TBD
BSL 21
6h 8m
Gosudark vs Kyrie
Gypsy vs OyAji
UltrA vs Radley
Dandy vs Ptak
Replay Cast
9h 8m
Sparkling Tuna Cup
20h 8m
WardiTV Korean Royale
22h 8m
LAN Event
1d 1h
IPSL
1d 4h
JDConan vs WIZARD
WolFix vs Cross
BSL 21
1d 6h
spx vs rasowy
HBO vs KameZerg
Cross vs Razz
dxtr13 vs ZZZero
Replay Cast
1d 19h
[ Show More ]
Wardi Open
1d 22h
WardiTV Korean Royale
2 days
Replay Cast
3 days
Kung Fu Cup
3 days
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
4 days
The PondCast
4 days
RSL Revival
4 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
4 days
WardiTV Korean Royale
4 days
RSL Revival
5 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
5 days
CranKy Ducklings
6 days
RSL Revival
6 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
6 days
Liquipedia Results

Completed

BSL 21 Points
SC4ALL: StarCraft II
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
Stellar Fest: Constellation Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 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.