我从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'
在座的任何人都有办法解决这个问题吗?
发布于 2015-04-14 22:23:26
来自常见问题解答:
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对象。
发布于 2019-08-10 21:30:22
尝试以下操作,将<QtXXX>
替换为您的模块。
#pragma unmanaged
#include <QtXXX>
#pragma managed
https://stackoverflow.com/questions/29610546
复制相似问题