简体   繁体   English

模板缺少Visual Studio社区2015 main.cpp

[英]Visual Studio Community 2015 main.cpp missing from template

I created an SFML template and encountered the issue to open main.cpp from the Source Files folder, I got the error message - "The document cannot be opened. It has been renamed, deleted or moved." 我创建了SFML模板,并遇到了从Source Files文件夹打开main.cpp的问题,我收到了错误消息-“无法打开文档。它已被重命名,删除或移动。” The next attempt to build the other template gave me the same result. 下次尝试构建其他模板也得到了相同的结果。 All templates I created in VS 2015 had the same issue, it didn't let me open the main file. 我在VS 2015中创建的所有模板都存在相同的问题,它不允许我打开主文件。 I didn't find any useful and similar cases with web search, If someone encountered the similar issues creating his own template in VS 2015, please share the solution how to fix that. 我没有在网络搜索中找到任何有用和类似的案例,如果有人在VS 2015中创建自己的模板时遇到类似的问题,请分享解决方案。

main.cpp didn't open up main.cpp没有打开

I'll be very grateful for any suggestion. 如有任何建议,我将不胜感激。

This is a real issue of VS 2015, here's how to solve it: 这是VS 2015的真实问题,以下是解决方法:

  1. Follow your steps 1 to 6 按照步骤1至6
  2. At step 7 make sure to uncheck "Automatically import the template into Visual Studio" 在步骤7中,确保取消选中“自动将模板导入Visual Studio”
  3. Click Finish 点击完成
  4. Extract the just created zip file of your template to a folder of your choice 将模板的刚创建的zip文件解压缩到您选择的文件夹中
  5. Now copy all your source (.cpp) and header (.h) files from your original SFML project to the extracted folder 现在,将所有源文件(.cpp)和头文件(.h)从原始SFML项目复制到提取的文件夹中
  6. In this folder look for MyTemplate.vstemplate and open it in a text editor 在此文件夹中查找MyTemplate.vstemplate并在文本编辑器中将其打开
  7. You will see a TemplateData and TemplateContent section 您将看到一个TemplateData和TemplateContent部分
  8. Inside the TemplateData section add the line true 在TemplateData部分内,添加true
  9. Inside the TemplateContent section add for each copied file from step 5 the lines filename.cpp or filename.h 在TemplateContent部分内,为步骤5中的每个复制文件添加filename.cpp或filename.h行
  10. Now put all files back into a zip file 现在将所有文件放回zip文件中
  11. Copy your new zip file to Visual Studio 2015\\Templates\\ProjectTemplates folder 将新的zip文件复制到Visual Studio 2015 \\ Templates \\ ProjectTemplates文件夹
  12. Restart Visual Studio and open a new project from your project template 重新启动Visual Studio并从您的项目模板中打开一个新项目

This blog post helped me figured it out: http://www.mvdcorput.nl/2016/03/creating-visual-studio-2015-project-template/ 这篇博客文章帮助我弄清楚了: http : //www.mvdcorput.nl/2016/03/creating-visual-studio-2015-project-template/

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

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