--------------------------------------------------------------------------------------
fatal error LNK1112: module machine type ‘x64‘ conflicts with target machine type ‘X86‘
These are the things to check, in this order: Check your properties options in your linker settings at: Properties > Configuration Properties > Linker > Advanced > Target Machine. Select MachineX64 if you are targeting a 64 bit build, or MachineX86 if you are making a 32 bit build.
Select Build > Configuration Manager from the main menu in visual studio. Make sure your project has the correct platform specified. It is possible for the IDE to be set to build x64 but an individual project in the solution can be set to target win32. So yeah, visual studio leaves a lot of rope to hang yourself, but that‘s life.
Check your library files that they really are of the type of platform are targeting. This can be used by using dumpbin.exe which is in your visual studio VC\bin directory. use the -headers option to dump all your functions. Look for the machine entry for each function. it should include x64 if it‘s a 64 bit build.
In visual studio, select Tools > Options from the main menu. select Projects and Solutions > VC++ Directories. Select x64 from the Platform dropdown. Make sure that the first entry is :$(VCInstallDir)\bin\x86_amd64 followed by $(VCInstallDir)\bin.
Once I did step 4 everything worked again for me.
LNK1112: module machine type ‘x64‘ conflicts with target machine type ‘X86‘
The problem has been solved. Many thanks to steve. Here is the solution, for those might have the same problem :) 1. To choose the x64 platform, click Build > Configuration Manager. Under Active Solution Platform, select <New...> In the dialog that comes up, select x64 as the new platform (it may come up by default) and then click Ok. 2. select the x64 platform in the VC window. 3. Check the Linker > Command Line property page to make sure there is no /MACHINE switch there 3.1 if you find /MACHINE ** in the additional options window, just deletle it. 3.2. if you find /MACHINE ** in the all options window, Go to the Linker > Advanced property page and make sure that Target Machine is "Not Set".lan
--------------------------------------------------------------------------------------
Error: QWidget: Cannot create a QWidget without QApplication
产生这个错误的原因是这个QWidget 是建立在QApplication 上的,(From the docs, the QApplication class manages the GUI application‘s control flow and main settings whilst the QCoreApplication class provides an event loop for console Qt applications)
application的类型需要为QApplication
#include<QApplication>
QApplication a(argc,argv);
--------------------------------------------------------------------------------------
ASSERT: "qGuiApp" in file kernel\qopenglcontext.cpp, line 1238
From the documentation of QOpenGLContext::openGLModuleType():
Note: This function requires that the QGuiApplication instance is already created.
You may set your desired version regardless of the openGLModuleType (remove the check) and check later if you got your requested version or not.
在调用QOpenGLContext::openGLModuleType()之前创建application即可
--------------------------------------------------------------------------------------