我从Qt的网站上下载了版本5.2.1,该版本说明可以与mscv2012_64_opengl一起使用。
在我决定使用公共语言运行时支持/clr
选项之前,它工作正常。我这样做是因为我使用的是.dll,它充当了C ++和我在C#中的一些代码之间的包装。
当我构建项目时,我收到以下错误
C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(74): error C2182: 't' : illegal use of type 'void'
1> c:\qt\qt5.2.1\5.2.1\msvc2012_64_opengl\include\qtcore\qmap.h(119) : see reference to class template instantiation 'QVector<T>' being compiled
1> with
1> [
1> T=void
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(903) : see reference to function template instantiation 'void std::allocator_traits<_Alloc>::construct<_Ty,_Ty>(std::allocator<_Ty> &,_Objty *,_V0_t &&)' being compiled
1> with
1> [
1> _Alloc=std::allocator<DataColumn_3D>,
1> _Ty=DataColumn_3D,
1> _Objty=DataColumn_3D,
1> _V0_t=DataColumn_3D
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(903) : see reference to function template instantiation 'void std::allocator_traits<_Alloc>::construct<_Ty,_Ty>(std::allocator<_Ty> &,_Objty *,_V0_t &&)' being compiled
1> with
1> [
1> _Alloc=std::allocator<DataColumn_3D>,
1> _Ty=DataColumn_3D,
1> _Objty=DataColumn_3D,
1> _V0_t=DataColumn_3D
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory(433) : see reference to function template instantiation 'void std::_Wrap_alloc<_Alloc>::construct<DataColumn_3D,_Valty>(_Ty *,_V0_t &&)' being compiled
1> with
1> [
1> _Alloc=std::allocator<DataColumn_3D>,
1> _Valty=DataColumn_3D,
1> _Ty=DataColumn_3D,
1> _V0_t=DataColumn_3D
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory(433) : see reference to function template instantiation 'void std::_Wrap_alloc<_Alloc>::construct<DataColumn_3D,_Valty>(_Ty *,_V0_t &&)' being compiled
1> with
1> [
1> _Alloc=std::allocator<DataColumn_3D>,
1> _Valty=DataColumn_3D,
1> _Ty=DataColumn_3D,
1> _V0_t=DataColumn_3D
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory(473) : see reference to function template instantiation '_FwdIt std::_Uninit_move<_InIt,_FwdIt,std::allocator<_Ty>,DataColumn_3D>(_InIt,_InIt,_FwdIt,std::_Wrap_alloc<_Alloc> &,_Valty *,std::_Nonscalar_ptr_iterator_tag)' being compiled
1> with
1> [
1> _FwdIt=DataColumn_3D *,
1> _InIt=DataColumn_3D *,
1> _Ty=DataColumn_3D,
1> _Alloc=std::allocator<DataColumn_3D>,
1> _Valty=DataColumn_3D
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector(1561) : see reference to function template instantiation '_FwdIt std::_Uninitialized_move<_Iter,DataColumn_3D*,std::_Wrap_alloc<_Alloc>>(_InIt,_InIt,_FwdIt,std::_Wrap_alloc<_Alloc> &)' being compiled
1> with
1> [
1> _FwdIt=DataColumn_3D *,
1> _Iter=DataColumn_3D *,
1> _Alloc=std::allocator<DataColumn_3D>,
1> _InIt=DataColumn_3D *
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector(1504) : see reference to function template instantiation 'DataColumn_3D *std::vector<_Ty>::_Umove<DataColumn_3D*>(_Iter,_Iter,DataColumn_3D *)' being compiled
1> with
1> [
1> _Ty=DataColumn_3D,
1> _Iter=DataColumn_3D *
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector(1504) : see reference to function template instantiation 'DataColumn_3D *std::vector<_Ty>::_Umove<DataColumn_3D*>(_Iter,_Iter,DataColumn_3D *)' being compiled
1> with
1> [
1> _Ty=DataColumn_3D,
1> _Iter=DataColumn_3D *
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector(1500) : while compiling class template member function 'void std::vector<_Ty>::_Reallocate(unsigned __int64)'
1> with
1> [
1> _Ty=DataColumn_3D
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector(961) : see reference to function template instantiation 'void std::vector<_Ty>::_Reallocate(unsigned __int64)' being compiled
1> with
1> [
1> _Ty=DataColumn_3D
1> ]
1> DataSource.cpp(256) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1> with
1> [
1> _Ty=DataColumn_3D
1> ]
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(133): error C2182: 'at' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(134): error C2182: '[]' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(135): error C2182: '[]' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(136): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(137): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(138): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(139): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(140): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(148): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(150): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(151): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(152): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(153): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(182): error C2182: 'x' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(183): error C2182: 'x' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(189): error C2182: 'first' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(190): error C2182: 'first' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(191): error C2182: 'last' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(192): error C2182: 'last' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(193): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(194): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(198): error C2182: 'defaultValue' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(204): error C2182: 'reference' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(205): error C2182: 'const_reference' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(210): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(211): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(216): error C2182: 'front' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(225): error C2182: 't' : illegal use of type 'void'
1>C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore/qvector.h(227): error C2182: 't' : illegal use of type 'void'
有没有人知道如何解决这个问题?
答案 0 :(得分:0)
来自常见问题:
Is there any way to compile the Qt source code and Qt applications with /clr flag?
我们不支持直接使用CLR构建Qt或Qt应用程序。要集成现有组件,您可以使用Active Qt框架,该框架允许在Qt应用程序中集成Active X和COM对象。
答案 1 :(得分:0)
尝试以下操作,将<QtXXX>
替换为模块。
#pragma unmanaged
#include <QtXXX>
#pragma managed