在Visual C ++ 2008中的单个文件编译和执行? [英] Single file compilation and execution in Visual C++ 2008?

查看:152
本文介绍了在Visual C ++ 2008中的单个文件编译和执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个关于C ++的教程(学习它)。最好的学习方式是通过例子。我有很少的.cpp文件,没有太多。我使用最好的C ++ IDE(Visual C ++)。有一种方法,我可以有一个项目叫教程指南,并使我的.cpp和.h文件,但是当我运行它们,它只运行当前文件。我听说调试运行项目中的所有文件,这将是一个混乱的教程类型项目。请仅回复Visual C ++答案。没有make .cpp并用Cygwin编译或使用this ide。我想熟悉Visual C ++ IDE。

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.

推荐答案

你不能像你想要的那样,一个项目暗示单个输出可执行文件。你可以做的是先创建一个空的解决方案,然后为每个.cpp文件创建一个新的项目(右键单击解决方案资源管理器中的解决方案图标并选择新项目)。

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.

这篇关于在Visual C ++ 2008中的单个文件编译和执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆