简体   繁体   English

将源文件复制到Visual Studio项目中

[英]Copying source files into a Visual Studio project

I've created a new Visual Studio C++ project and I'd like to import copies of a number of C and header files into the project. 我已经创建了一个新的Visual Studio C ++项目,我想将许多C和头文件的副本导入到项目中。 That is, the files are currently in a folder on my desktop and I'd like to import them such that copies are placed in the newly created project folder. 也就是说,文件当前位于我桌面上的文件夹中,我想导入它们,使副本放在新创建的项目文件夹中。

How would I do this? 我该怎么做? I've tried using File | 我尝试过使用File | New | 新的| Project from Existing Code but that just keeps the files in their existing location. 来自现有代码的项目,但只是将文件保存在其现有位置。 I've even tried a simple Ctrl-C and Ctrl-V and again that imported the files but they stayed in the same place on disk. 我甚至尝试过一个简单的Ctrl-CCtrl-V,并再次导入文件,但它们保留在磁盘上的相同位置。

在Windows资源管理器中将文件复制到新位置,然后启动Visual Studio并将它们作为现有项添加到项目中。

我认为更好的解决方案是创建一个新的(空)项目,并在“Headers”和“Sources”的上下文菜单中按“Add - > Existing item”添加h和cpp文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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