fatal error C1189: #error: <future> is not supported when compiling with /clr or /clr:pure - visual-studio

When porting Qt to 5.10.1, I am getting following error
Reason for Error: Visual studio Build with clr(Common language runtime ) support settings, so that above error is generated.
C/C++ Advanced > showIncludes sets "Yes", so It has been identified that from Qt's QThread above error is generated.
How to resolve above error in Qt 5.10.1 with VS2015 ?
Note: I am using C# dll in my Qt VS project

Make sure QThread doesn't include when clr is enabled.
I have done conditional compilation for my project include
#ifndef CLR_ENABLED
#include <QtCore/QThread> //Error C1189: #error: <future> is not supported when compiling with /clr or /clr:pure. Qt5 porting.
#endif

Related

vs2017 compile error: double inclusion of header boost/config/abi_prefix.hpp

I upgraded some vc2008 projects into vc2017 projects, and replaced boost_1_47 with boost_1_64.
Vc2008 projects were correctly compiled, but vc2017 projects reported an error:
fatal error C1189: double inclusion of header boost/config/abi_prefix.hpp is an error
what does it means? And how to solve it?
I used VS2017 with vc141 toolset and windows 10 SDK

How to compile (and link) a python module using PyQt (and sip) under windows

I have a C++ project using Qt5 (also compiles with Qt4) which I want to make available in python (preferable 3.4). In order to do this I use PyQt4 (because of the QtXml module which is, as far as I know, not available in PyQt5 anymore) and sip. This all works perfectly on my linux machine. But unfortunately I need it for windows and can't get it run. What I have done so far:
A very small example without Qt or other dependencies (one function which returns an integer) works. Even with gcc. But after an "bad reloc" error in my project I switched to the MSVC
My python 3.4 was build with "MSC v.1600 32 bit (Intel)" "on win32" so according to What version of Visual Studio is Python on my computer compiled with? I downloaded Qt 5.2.1 MSVC2010 and Microsoft Visual Studio Express 2010 SP1
I assume that the precompiled PyQt4-4.11.2-gpl-Py3.4-Qt5.3.1-x32 should fit
In order to get the sip.h and sipconfig.py file I compiled sip (4.16.3).
From now on I am unsure what to do. I have to admit that I have no knowledge about libraries.
The C++/Qt project is compiled with QtCreator with CONFIG += staticlib and TEMPLATE = lib. The resulting *.lib (here: xml2db.lib) is been copied to the folder where my sip files are (e.g. sipxml2dbcmodule.cpp)
So via the "VS Command Prompt" nmake throws fatal (link) errors. I'm unsure what the needed compiler flags should be or if the staticlib is wrong. My flags are:
LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /DLL /MANIFEST /MANIFESTFILE:$(TARGET).manifest /SUBSYSTEM:WINDOWS /INCREMENTAL:NO /NODEFAULTLIB:library /LIBPATH:/LIBPATH:C:\Qt\5.2.1\msvc2010\lib
LIBS = /LIBPATH:C:\Python34\libs python34.lib xml2db.lib /LIBPATH:C:\Qt\5.2.1\msvc2010\lib\Qt5Xmld.lib C:\Qt\5.2.1\msvc2010\lib\Qt5Sqld.lib C:\Qt\5.2.1\msvc2010\lib\Qt5Cored.lib
$(TARGET): $(OFILES)
$(LINK) $(LFLAGS) /OUT:$(TARGET) $(OFILES) $(LIBS)
Where target is "myTools.pyd". It results in
sipmyToolscmodule.cpp
sipmyToolsxml2db.cpp
Generating Code...
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DLL /MANIFEST /MANIFESTFILE:myTools
.pyd.manifest /SUBSYSTEM:WINDOWS /INCREMENTAL:NO /NODEFAULTLIB:library /LIBPATH:
C:\Qt\5.2.1\msvc2010\lib /OUT:myTools.pyd sipmyToolscmodule.obj sipmyToolsxml2db
.obj /LIBPATH:C:\Python34\libs python34.lib xml2db.lib /LIBPATH:C:\Qt\5.2.1\msvc
2010\lib\Qt5Xmld.lib C:\Qt\5.2.1\msvc2010\lib\Qt5Sqld.lib C:\Qt\5.2.1\msvc2010\l
ib\Qt5Cored.lib
xml2db.lib(xml2db.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_L
EVEL': value '2' doesn't match value '0' in sipmyToolscmodule.obj
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_i
nfo(class type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIB
CMT.lib(typinfo.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall
type_info::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z)
already defined in LIBCMT.lib(typinfo.obj)
Creating library myTools.lib and object myTools.exp
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
myTools.pyd : fatal error LNK1169: one or more multiply defined symbols found
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\link.EXE"' : return code '0x491'
Stop.
I would be pleased for an answer or fresh idea. Thanks in advance.
EDIT
I don't know exactly how I solved it but here are a few more hints that helped me to solve it.
Since sip 5 won't have the build system I tried to create a qmake project. To do so I downloaded the pyqt source package and looked at the project files and adjusted it to my needs.
Especially when you are changing the qmake project file it might be usefull to delete the make, object and/or moc files.
The qt version should perfectly match to the pyqt version (actually I don't mean the version itself but the qt version it was compiled for)
Good luck for those who have similiar problems

Using directX 11 in Visual Studio 6.0

I want use include files
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dcompiler.h>
#include <xnamath.h>
in visual studio 6.0.
But when i compile .cpp i we got this error:
:\Users\8up tuotlo\Desktop\Visual C++ 6.0 Proects\11\Article1\Article1.cpp(28) : error C2146: syntax error : missing ';' before identifier 'CD3D11_DEFAULT'
:\Users\8up tuotlo\Desktop\Visual C++ 6.0 Proects\11\Article1\Article1.cpp(28) : error C2146: syntax error : missing ';' before identifier 'CD3D11_DEFAULT'
When i include:
#include <d3d9.h>
#include <d3dx9.h>
All normally compile.
What is this thing?
Check the compiler support for recent versions of the Windows SDK. I suspect that VC++6 is no longer supported (it is over 15 years since it was released, with six releases since then).

Visual Studio 2010 includes MFC even though empty console application is specified (C++)

I've spent most of my day trying to figure out why this error is occurring but it continues to mystify me.
I created a console application in Visual C++ and specified it to be empty. After putting all of my source in the virtual folder and compiling it an error occurred:
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
Strange error indeed, because I never included any MFC files. So I remedied the situation by specifying "/MT" in the code generation settings.
This worked well...until I decided to include "Windows.h", which spawned this error:
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxv_w32.h(16): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include windows.h
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxv_w32.h(16): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include windows.h
I've tried everything I could think of, including recreating the project with and without precompiled headers, a Win32 app rather than console, and a WxWidget app. All of these apps seemingly try to include MFC even though I never specified. Can anyone shed some light on this problem? Thank you!
Find out what's including the MFC headers - the /showIncludes option may help with that.
Which in the IDE project property page is under:
C/C++ | Advanced | Show Includes
Once you know who is including them you can make a decision on how to address the problem - you might simply be able to remove an errant #include, but it might require jettisoning a library you're using that's dependent on MFC.
Make sure 'USE of MFC' is in 'Use MFC in a Shared DLL' setting. That fixed it for me.
If MFC is required, set the following values ( Debug/Win32 ):
Configuration Properties > General :
Use of MFC : Use MFC in a Shared DLL
Configuration Properties > C/C++ > Code Generation :
Runtime Library : /MDd
If MFC is not required, and only standard window libraries are required, keep the setting as below.
Configuration Properties > General :
Use of MFC : Use Standard Windows Libraries
Configuration Properties > C/C++ > Code Generation :
Runtime Library : /MTd

PhysX - Compiling Error

I'm just trying to build the Lesson 101 from PhysX tutorials. I'm using VS2008 and this is the compile error im getting. Not sure what to do...?
Im using Windows 7.
1>------ Build started: Project: L101, Configuration: Debug Win32 ------
1>Compiling...
1>Lesson101.cpp
1>c:\program files\nvidia corporation\nvidia physx sdk\v2.8.1\sdks\foundation\include\nx.h(34) : fatal error C1189: #error : custom definition of NX_CALL_CONV for your OS needed!
Thanks
Write
#define WIN32
before including the PhysX header files.

Resources