Can#39;t find Windows Forms Application for C++(找不到适用于 C++ 的 Windows 窗体应用程序)
问题描述
总的来说,我对视觉工作室和编程非常陌生.我正在使用 Visual Studio Community 2015 桌面版(据我所知).我在 C++ 类别中找不到 Windows 窗体应用程序,而在 C# 类别中有一个.
I'm really new to visual studio and programming in general. I'm using Visual Studio Community 2015 Desktop Version (from what I know). I can't find a Windows Forms Application from the C++ category, while there is one for C#.
任何人都可以帮忙,我需要下载另一个版本、插件或其他任何东西吗?对不起,如果一个愚蠢的问题,我真的想不通!
Can anyone help, do I need to download another version, a plugin, or anything? Sorry if a stupid question, I just really can't figure it out!
推荐答案
Visual Studio 2015 中没有 C++ Windows 窗体模板.在我看来,您有两个选择:
There are no C++ Windows Form templates in Visual Studio 2015. As I see it, you have two choices:
- 创建新项目时,您将看到一个在线下拉菜单,单击该下拉菜单并尝试搜索C++ Windows 窗体".
创建一个空的 C++ CLR 项目并向其中添加一个 Windows 窗体.这个 link 是这样写的(归功于发布此内容的用户 onContentStop):
- When creating a new project, You will see an online dropdown, click that and try to search for "C++ Windows Forms".
Create an empty C++ CLR project and add a Windows Forms to it. This link puts it like this (credit to the onContentStop, the user who posted this):
- 制作CLR 空项目".
- 按 Ctrl-Shift-A 并创建一个 Windows 窗体(在 UI 下).
在创建的 CPP 文件中,粘贴此代码,将方括号中除
[STAThread]之外的任何内容替换为适当的名称:
- Make a "CLR Empty Project".
- Press Ctrl-Shift-A and create a Windows Form (under UI).
Inside the CPP file that is created, paste this code, replacing anything in square brackets except
[STAThread]with the appropriate names:
#include "[FORM NAME].h"
using namespace System;
using namespace System::Windows::Forms;
[STAThread]//leave this as is
void main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew [PROJECT NAME]::[FORM NAME]);
}
在解决方案资源管理器中右键单击您的项目,然后单击属性.
Right click your project in the Solution Explorer and click Properties.
这篇关于找不到适用于 C++ 的 Windows 窗体应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:找不到适用于 C++ 的 Windows 窗体应用程序
基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- CString 到 char* 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
