Cygwin+Eclipse:如何在不出现无法识别的仿真模式错误的情况下,在基于 OpengGL 的程序中隐藏控制台 window?

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

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

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

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)

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

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