c++ - Cygwin+ eclipse : How does one hide a console window in n OpengGL based program by without getting unrecognized emulation mode error?

标签 c++ windows eclipse cygwin freeglut

我在 Windows 7 64 位机器上使用带有 glut32 库的新安装的 cygwin。我正在尝试使用 Eclipse IDE 用 C++ 编写一个测试程序。标准终端程序和测试 GLUT32 程序按预期构建和运行。我试图在我的测试程序的发布版本中隐藏控制台窗口。

我试图在链接器步骤中使用 -mwindows 标志来抑制控制台窗口,但我得到以下信息:

11:15:04 **** Incremental Build of configuration Release for project Test ****
make all 
Building file: ../src/Test.cpp
Invoking: Cygwin C++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Test.d" -MT"src/Test.o" -o "src/Test.o" "../src/Test.cpp"
Finished building: ../src/Test.cpp

Building target: Test.exe
Invoking: Cygwin C++ Linker
g++ -L"C:\cygwin\lib" -Xlinker -mwindows -shared -o "Test.exe"  ./src/Test.o   -lglut32 -lglu32 -lopengl32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: unrecognised emulation mode: windows
Supported emulations: i386pep i386pe
collect2: error: ld returned 1 exit status
make: *** [makefile:47: Test.exe] Error 1

11:15:05 Build Finished (took 376ms)

我认为支持的仿真语句可能是一个提示。我是否以某种方式使用了错误的编译器?如何在后台不弹出控制台窗口的情况下构建完成的程序?

最佳答案

我无法解释原因,但是当我在编译步骤而不是链接步骤中使用 -mwindows 标志时,问题就解决了。程序构建没有问题,无需控制台即可运行。

关于c++ - Cygwin+ eclipse : How does one hide a console window in n OpengGL based program by without getting unrecognized emulation mode error?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47379059/

相关文章:

c++ - 我究竟应该在我的 OpenGL C++ 项目中的什么地方添加我的 BMP 文件?使用适用于 Mac 的 Xcode

C++从 double 组中减去均值

c++ - 谁能给我解释一下这段代码

python - 通过 Curl 向 Flask 发送 JSON 请求

windows - QT:外部拖放后的通知

eclipse - 向 Eclipse 添加 GLSL 语法高亮显示

java - Eclipse Javadoc 后台覆盖默认值

c++ - 如何检查普通字符是否已签名或未签名?

windows - Windows 任务管理器中的 "dump file"是什么?

django - 如何使用 Eclipse 和 Pydev 正确调试?