-2

So basicly I have my cpp files written in Code::Blocks, and I need to run them on Xcode. The problem starts when i open the file in Xcode, I can see the code, but when I go to menu -> product menus like run and build is greyed out, but when I creat new projects and choose command line tool and then choose C++ and rewrite code there, I am able to run it, but imageing when the code is realy long, what do I do then?

4

1 回答 1

0

Xcode needs files to be added to a project to be able to run them. If you want don't want to use a project, you can use g++ from the command line:

g++ -o myExecutable myFile.cpp

You can then run:

./myExecutable

This is easy for single files, but Xcode is easier when your projects have dozens or hundreds of files.

于 2013-09-06T22:16:35.980 回答