tags:

views:

80

answers:

2

I am doing a tutorial on C++ (learning it). The best way to learn is by example. I have little .cpp files with not much in them. I am using the best C++ IDE (Visual C++). Is there a way where I can have a project called "Tutorial Guide" and make my .cpp and .h files, BUT when I run them, it only runs the current file. I have heard that the debug runs ALL the files in the project and that would be a chaos in a tutorial type project. Please respond with Visual C++ answers only. No "make the .cpp and compile with Cygwin" or "use this ide instead". I would like to familiarize myself with the Visual C++ IDE.

+4  A: 

You cannot do it like you seem to want, a project implies a single output executable. What you can do is create an empty solution first then for each .cpp file you create a new project (right click the solution icon in the solution explorer and select new project).

You can then right click each project and select "Set as startup project" this will change which one runs when you hit debug.

tyranid
Or you can right-click on a project in Solution Explorer and run/debug that specific project using its context menu. But, yes, 1 project per output .exe would be a requirement.
Pavel Minaev
A: 

From your question your best bet would be to do each tutorial as a district project. That way you could easily organize your projects and VS will build them all as you requested but will only run the project you have selected as the startup project.

rerun