简体   繁体   中英

How do I choose which .cpp file to run in XCode?

I've seen some responses to things like this, but I'm still not sure what to do. I'm proficient in Java with Eclipse, and am starting C++ with XCode. I'm using a textbook, so I'd like to organize my workspace with one .cpp file for each chapter, but when I do this and try to run one of the files, it always defaults to the first one. How can I have multiple .cpp files in a workspace and run different ones? This might be a fundamentally different thing than in java where you could just select the class, and if it had a main method run it from there, but any help would be appreciated. My workspace setup currently looks like this: http://i.imgur.com/HUh5lHL.png

What πάντα ῥεῖ says is right. To put it more bluntly, you probably don't want a single Xcode project with a different .cpp file per chapter of your text. (You can do it that way, but it involves a bunch of setup that will be confusing to you as a newbie with C++ and Xcode.) It would probably be easier if you made a separate Xcode project for each chapter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM