Closed 1m188 closed 5 years ago
qt程序 内置规则会自动追加 subsystem:windows -entry:mainCRTStartup
所以用户强行再去设置 就会有冲突
而代码里面设置 估计连接器直接忽略了flags设置 所以有效
回头我处理下 内置规则里面判断如果用户自己设置了entry 就不再自动设置entry
我改进过了,如果用户自己设置了entry 就不再自动设置entry 你可以更新到 dev 版本试试,xmake update dev
似乎仍然不行。我不确定我是否更新成功了,dev版本是这个吗?调用了xmake --version之后出现的版本号是 xmake v2.2.8+201910160317 。如果不是的话就应该是我的更新过程出了问题,如果是的话那么表现和之前的一样,重启了vscode什么的也是一样。
2019-10-16-03:17 不是晚上的版本,xmake update -s dev 仅更新下脚本试试
嗯这个有效,搞定了,谢谢!
描述问题
在xmake.lua中设置了add_ldflags("-subsystem:console","-entry:main"),但是控制台没有显示出来(相应的测试字符串没有输出),但是如果在代码里加入#pragma comment(linker, "/subsystem:\"console\" /entry:\"main\""),则控制台能够显示并且输出相应的字符串。
期待的结果
希望xmake.lua中的设置能够生效,而不用在代码之中设置
错误信息
xmake.lua的内容如下:
main.cpp中的内容如下:
xmake -v的内容如下: configure { qt_sdkver = 5.12.3 arch = x86 ccache = true plat = windows cxx = cl.exe mode = debug ndk_stdcxx = true host = windows ld = link.exe kind = static buildir = build vs = 2017 qt = D:/Development/Qt/Qt5.12.3/5.12.3/msvc2017 } [ 0%]: compiling.debug src\Widget\Widget.cpp cl.exe -c -FS -Zi -Fdbuild\windows\x86\debug\compile.qtxmakedemo.pdb -Od -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtWidgets -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtCore -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtGui -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtQml -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtNetwork -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\mkspecs\\win32-msvc -DDEBUG -DQT_QML_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -D_WINDOWS -nologo -Fobuild\.objs\qtxmakedemo\windows\x86\debug\src\Widget\Widget.cpp.obj src\Widget\Widget.cpp[ 50%]: compiling.debug src\main.cpp cl.exe -c -FS -Zi -Fdbuild\windows\x86\debug\compile.qtxmakedemo.pdb -Od -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtWidgets -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtCore -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtGui -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtQml -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include\\QtNetwork -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\include -ID:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\mkspecs\\win32-msvc -DDEBUG -DQT_QML_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -D_WINDOWS -nologo -Fobuild\.objs\qtxmakedemo\windows\x86\debug\src\main.cpp.obj src\main.cpp [100%]: linking.debug qtxmakedemo.exe link.exe -libpath:D:\\Development\\Qt\\Qt5.12.3\\5.12.3\\msvc2017\\lib -debug -pdb:build\windows\x86\debug\qtxmakedemo.pdb Qt5Widgetsd.lib Qt5Cored.lib Qt5Guid.lib Qt5Qmld.lib Qt5Networkd.lib Qt53DAnimation.lib Qt53DAnimationd.lib Qt53DCore.lib Qt53DCored.lib Qt53DExtras.lib Qt53DExtrasd.lib Qt53DInput.lib Qt53DInputd.lib Qt53DLogic.lib Qt53DLogicd.lib Qt53DQuick.lib Qt53DQuickAnimation.lib Qt53DQuickAnimationd.lib Qt53DQuickd.lib Qt53DQuickExtras.lib Qt53DQuickExtrasd.lib Qt53DQuickInput.lib Qt53DQuickInputd.lib Qt53DQuickRender.lib Qt53DQuickRenderd.lib Qt53DQuickScene2D.lib Qt53DQuickScene2Dd.lib Qt53DRender.lib Qt53DRenderd.lib Qt5AccessibilitySupport.lib Qt5AccessibilitySupportd.lib Qt5AxBase.lib Qt5AxBased.lib Qt5AxContainer.lib Qt5AxContainerd.lib Qt5AxServer.lib Qt5AxServerd.lib Qt5Bluetooth.lib Qt5Bluetoothd.lib Qt5Bootstrap.lib Qt5Charts.lib Qt5Chartsd.lib Qt5Concurrent.lib Qt5Concurrentd.lib Qt5Core.lib Qt5DataVisualization.lib Qt5DataVisualizationd.lib Qt5DBus.lib Qt5DBusd.lib Qt5Designer.lib Qt5DesignerComponents.lib Qt5DesignerComponentsd.lib Qt5Designerd.lib Qt5DeviceDiscoverySupport.lib Qt5DeviceDiscoverySupportd.lib Qt5EdidSupport.lib Qt5EdidSupportd.lib Qt5EglSupport.lib Qt5EglSupportd.lib Qt5EventDispatcherSupport.lib Qt5EventDispatcherSupportd.lib Qt5FbSupport.lib Qt5FbSupportd.lib Qt5FontDatabaseSupport.lib Qt5FontDatabaseSupportd.lib Qt5Gamepad.lib Qt5Gamepadd.lib Qt5Gui.lib Qt5Help.lib Qt5Helpd.lib Qt5Location.lib Qt5Locationd.lib Qt5Multimedia.lib Qt5Multimediad.lib Qt5MultimediaQuick.lib Qt5MultimediaQuickd.lib Qt5MultimediaWidgets.lib Qt5MultimediaWidgetsd.lib Qt5Network.lib Qt5Nfc.lib Qt5Nfcd.lib Qt5OpenGL.lib Qt5OpenGLd.lib Qt5OpenGLExtensions.lib Qt5OpenGLExtensionsd.lib Qt5PacketProtocol.lib Qt5PacketProtocold.lib Qt5PlatformCompositorSupport.lib Qt5PlatformCompositorSupportd.lib Qt5Positioning.lib Qt5Positioningd.lib Qt5PositioningQuick.lib Qt5PositioningQuickd.lib Qt5PrintSupport.lib Qt5PrintSupportd.lib Qt5Qml.lib Qt5QmlDebug.lib Qt5QmlDebugd.lib Qt5QmlDevTools.lib Qt5Quick.lib Qt5QuickControls2.lib Qt5QuickControls2d.lib Qt5Quickd.lib Qt5QuickParticles.lib Qt5QuickParticlesd.lib Qt5QuickShapes.lib Qt5QuickShapesd.lib Qt5QuickTemplates2.lib Qt5QuickTemplates2d.lib Qt5QuickTest.lib Qt5QuickTestd.lib Qt5QuickWidgets.lib Qt5QuickWidgetsd.lib Qt5RemoteObjects.lib Qt5RemoteObjectsd.lib Qt5Scxml.lib Qt5Scxmld.lib Qt5Sensors.lib Qt5Sensorsd.lib Qt5SerialBus.lib Qt5SerialBusd.lib Qt5SerialPort.lib Qt5SerialPortd.lib Qt5Sql.lib Qt5Sqld.lib Qt5Svg.lib Qt5Svgd.lib Qt5Test.lib Qt5Testd.lib Qt5TextToSpeech.lib Qt5TextToSpeechd.lib Qt5ThemeSupport.lib Qt5ThemeSupportd.lib Qt5UiTools.lib Qt5UiToolsd.lib Qt5VulkanSupport.lib Qt5VulkanSupportd.lib Qt5WebChannel.lib Qt5WebChanneld.lib Qt5WebEngine.lib Qt5WebEngineCore.lib Qt5WebEngineCored.lib Qt5WebEngined.lib Qt5WebEngineWidgets.lib Qt5WebEngineWidgetsd.lib Qt5WebSockets.lib Qt5WebSocketsd.lib Qt5WebView.lib Qt5WebViewd.lib Qt5Widgets.lib Qt5WindowsUIAutomationSupport.lib Qt5WindowsUIAutomationSupportd.lib Qt5WinExtras.lib Qt5WinExtrasd.lib Qt5Xml.lib Qt5Xmld.lib Qt5XmlPatterns.lib Qt5XmlPatternsd.lib qtfreetype.lib qtfreetyped.lib qtlibpng.lib qtlibpngd.lib qtmain.lib qtmaind.lib ws2_32.lib gdi32.lib ole32.lib advapi32.lib shell32.lib user32.lib OpenGL32.lib imm32.lib winmm.lib iphlpapi.lib -subsystem:console -entry:main -subsystem:windows -entry:mainCRTStartup -nologo -dynamicbase -nxcompat -machine:x86 -out:build\windows\x86\debug\qtxmakedemo.exe build\.objs\qtxmakedemo\windows\x86\debug\src\Widget\Widget.cpp.obj build\.objs\qtxmakedemo\windows\x86\debug\src\main.cpp.obj
其中有一段是-subsystem:console -entry:main -subsystem:windows -entry:mainCRTStartup这个参数设置,似乎是前面的是用户自定义的设置,后面的是强制的设置并且覆盖了前面的设置?
相关环境
vscode版本: 1.39.2 (system setup) OS: Windows_NT x64 10.0.18362 xmake版本v2.2.8+201908261502 qt版本:5.12.3 msvc2017 32bit
其他信息