如何使用 C++(非控制台应用程序)在 Eclipse 中构建 Windows GUI 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18359767/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 21:55:24  来源:igfitidea点击:

How do I build a Windows GUI Application in Eclipse using C++ (a non console application)

c++windowseclipse-cdt

提问by user2703899

I can't seem to figure out how build a windows GUI application in Eclipse with C++ . I can only build to a console. When I create a new project it doesn't give me the option for a Windows Application. I'm using Eclipse IDE for C/C++. Am I downloading the wrong flavor of Eclipse? What am I doing wrong?

我似乎无法弄清楚如何在 Eclipse 中使用 C++ 构建 Windows GUI 应用程序。我只能构建到控制台。当我创建一个新项目时,它没有为我提供 Windows 应用程序的选项。我将 Eclipse IDE 用于 C/C++。我是否下载了错误的 Eclipse 版本?我究竟做错了什么?

采纳答案by kaliatech

Unlike Visual Studio, Eclipse CDT does not have a built-in wizard or options for automatically configuring compiler settings and libraries for building Windows GUI applications. You will need to know what you are doing. Do you intend to build the GUI using Win32/MinGW, or perhaps using some other GUI library, like Qtor wxWidgets? There are many options.

与 Visual Studio 不同,Eclipse CDT 没有用于自动配置编译器设置和库以构建 Windows GUI 应用程序的内置向导或选项。你需要知道你在做什么。您打算使用 Win32/ MinGW构建 GUI ,还是使用其他一些 GUI 库,如QtwxWidgets?有很多选择。

If you are new to C++ and/or GUI development on windows, then there are easier options to get started with.

如果您不熟悉 Windows 上的 C++ 和/或 GUI 开发,那么有更简单的选项可以开始使用。

回答by user1283078

Here is an example to get you started with creating a simple window: http://www.winprog.org/tutorial/simple_window.html

下面是一个让您开始创建简单窗口的示例:http: //www.winprog.org/tutorial/simple_window.html

compiled with mingw this will open a console + the created window. To hide the console, just add this linker flag: -mwindows

用 mingw 编译这将打开一个控制台 + 创建的窗口。要隐藏控制台,只需添加此链接器标志:-mwindows