Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Xcode 5 won't compile cpp

Hi, you all!


My program runs without problems, when I click that "play" button, that little notification says "build succeded", but no nothing appears on the little white screen under the code itself.

I'm new to xcode (and mac) so I really don't know what I am doing wrong. I've been able to compile other programs in C++, but this one (wich access, reads and writes on a .txt file).

A friend of mine sent me his code for me to test and see if the problem was in my code or on the compiler itself. His program didn't compile either, so I think the problem is with Xcode 5.


Thanks in advance!


Yuri

MacBook Air, OS X Mountain Lion (10.8.5), Macbook Air mid 2013

Posted on Nov 17, 2013 3:03 PM

Reply
8 replies

Nov 18, 2013 6:43 AM in response to Yurilasz

Yurilasz wrote:


So what do you think I can change in my code to make it work?

There are numerous different ways to refer to a file for I/O. You can read it from standard input. You can get the path from a command line argument. You can ask the user for the path. You can wirte a GUI that has an NSOpenPanel to ask for the path. You can even hard-code the path.


Pretty much the only thing you can't do - because it is fundamentally wrong and guaranteed to fail in all environments except one - is what you are doing. Do not use relaitive paths. When you refer to "input.txt" in the code, there is only one place where thta will work. You can't easily get there with Xcode. If you search for a very similar thread in this same forum, you can find instructions I posted on how to get to that path. But it is so pointless and wrong that I'm not going to bother to repeat.


If you want to use Windows, then use Windows and be done with it.

Xcode 5 won't compile cpp

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.