[英]hiding console window LNK4044 warning
I'm using scons to compile my C++ app disabling console window but I can't get this done. 我正在使用scons来编译我的C ++应用程序以禁用控制台窗口,但无法完成此操作。 Searching in the internet, and in StackOverflow, I found that this line would work
在Internet和StackOverflow中进行搜索,我发现这行有效
env.Append( LINKFLAGS=['-Wl,-subsystem,windows'] )
The problem is I always receive a warning message that this line is ignored. 问题是我总是收到一条警告消息,该行被忽略。 This is the message:
这是消息:
LINK : warning LNK4044: unrecognized option '/Wl,-subsystem,windows'; ignored
I've already tried: env.Append( LINKFLAGS=['-Wl,-subsystem:windows'] )
我已经尝试过:
env.Append( LINKFLAGS=['-Wl,-subsystem:windows'] )
env.Append( LINKFLAGS='-Wl,-subsystem,windows' )
env.Append( LINKFLAGS=['/Wl,-subsystem,windows'] )
env.Append( LINKFLAGS=['/Wl,-subsystem:windows'] )
Like you noticed, many possibilities I've done, but no sucess. 就像您注意到的那样,我已经做了很多可能性,但是没有成功。 Below I post some part of my SConstruct file.
在下面,我发布了我的SConstruct文件的一部分。 Any help is very appreciated.
任何帮助都非常感谢。
Thanks for all replies 感谢所有回覆
# GNU GCC
if 'gcc' in env[ 'compiler' ]:
env.Append( CCFLAGS='-Wall', CPPDEFINES=['GCC'] )
if int( debug ):
env.Append( CCFLAGS='-g', LINKFLAGS='-g' )
else:
env.Append( CCFLAGS='-O2', LINKFLAGS='-O2' )`
# MSVC v9
elif 'msvc' in env['compiler']:
env.Append( LINKCOM=[ 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1' ] )
env.Append( SHLINKCOM=[ 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2' ] )
env.Append( CCFLAGS='/W3 /EHsc', CPPDEFINES=[ 'WIN32', 'WINDOWS', 'MSVC', '_CRT_SECURE_NO_WARNINGS' ] )
env.Append( CPPDEFINES='MSVC_DLL' )
env.Append( LIBS = 'WS2_32' )
env.AppendUnique( LINKFLAGS=['-Wl,-subsystem,windows'] )
if int( debug ):
env.Append( CCFLAGS='/Od /RTC1 /MDd /Gy /Zi', LINKFLAGS='/DEBUG' )
else:
env.Append( CCFLAGS='/O2 /Oi /GL /MD', LINKFLAGS='/LTCG')`
env.Append(LINKFLAGS=['/Wl', '/SUBSYSTEM:WINDOWS']) env.Append(LINKFLAGS = ['/ Wl','/ SUBSYSTEM:WINDOWS'])
not sure if its case sensitive but that should work. 不知道它是否区分大小写,但是应该可行。 Your options just aren't getting fed to the linker right it seems.
您的选择似乎并没有正确地显示在链接器中。
Sorry guys. 对不起大家。 I've made a mistake.
我弄错了 Wl, is just for supress warnings;
Wl,仅用于警告警告; Like you said: it's just to insert
env.Append(LINKFLAGS=['/Wl', '/SUBSYSTEM:WINDOWS'])
in the SConstruct. 就像您说的:只是在
env.Append(LINKFLAGS=['/Wl', '/SUBSYSTEM:WINDOWS'])
中插入env.Append(LINKFLAGS=['/Wl', '/SUBSYSTEM:WINDOWS'])
。 I've made a very dummy mistake. 我犯了一个非常假的错误。 In the main.cpp I forgot to do a simple verification of if I running my software on a console or on a windowed app.
在main.cpp中,我忘了做一个简单的验证,即我是在控制台上还是在窗口化应用程序中运行软件。 Just a simple #ifdef WIN32_LEAN_AND_MEAN
只是一个简单的#ifdef WIN32_LEAN_AND_MEAN
thanks for you support. 感谢你的支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.