编译器错误 C2719 & Eigen库出现的对齐问题
2013-02-22 16:57
651 查看
注意收集错误信息,通过“输出”窗口,定位到具体代码行!!!
解决方案:
http://eigen.tuxfamily.org/dox/TopicStlContainers.html
eigen 3.1.2有 bug,
更新daily build版本: (官网 https://bitbucket.org/eigen/eigen/)
hg clone https://bitbucket.org/eigen/eigen/
并修改 RealScalar p => const RealScalar& p
关于为何更改的网页找不到了。。。 大致意思是这个: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=83
msvc2008才会出现此错误,2010没有。
解释大致为:
error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned?
It is a known issue that stl::vectorcannot properly contain aligned data, such as D3DXMATRIXA16. One poster pinned
the root cause (or at least, one of them?): the declaration of vector::resize passes the aligned data by value, and not as const reference. Several workarounds were suggested in that thread, the safest being dropping
stl::vector altogether. You might also want to fix the stl headers yourself and recompile - this actually may be easier than it sounds, but I haven't done so myself.
EDIT: links are now broken (thanks @David Menard), here's an
alternative, more elaborate answer.
The issue is fixed in VS2012RC - here's a link to a
corresponding connect issue. Turns out it was actually an issue in the C++ standard itself, fixed in 2008.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(zz)使用Eigen库出现的对齐问题。
2012-03-13 19:34:36| 分类:reproduct|标签:eigenvs2010|字号大中小订阅
error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned
2012-02-09 12:42
英文提示:error C2719: 'p': formal parameter with __declspec(align('16')) won't be aligned 中文提示:error C2719: “p”: 具有 __declspec(align('16')) 的形参将不被对齐 导致整个现象的主要原因是使用了Eigen库,Eigen为了使用SSE加速,所以内存分配上使用了128位的指针。 更加准确的说法: “First, "fixed-size" should be clear: an Eigen object has fixed size if its number of rows and its number of columns are fixed at compile-time. So for example Matrix3f has fixed size, but MatrixXf doesn't (the opposite of fixed-size is dynamic-size). The array of coefficients of a fixed-size Eigen object is a plain "static array", it is not dynamically allocated. For example, the data behind a Matrix4f is just a "float array[16]". Fixed-size objects are typically very small, which means that we want to handle them with zero runtime overhead -- both in terms of memory usage and of speed. Now, vectorization (both SSE and AltiVec) works with 128-bit packets. Moreover, for performance reasons, these packets need to be have 128-bit alignment. So it turns out that the only way that fixed-size Eigen objects can be vectorized, is if their size is a multiple of 128 bits, or 16 bytes.Eigen will then request 16-byte alignment for these objects, and henceforth rely on these objects being aligned so no runtime check for alignment is performed.” 解决方案: 分为四种情况: Cause 1: Structures having Eigen objects as members Cause 2: STL Containers Cause 3: Passing Eigen objects by value Cause 4: Compiler making a wrong assumption on stack alignment (for instance GCC on Windows) 每种情况可以对照官方的说法。可以参考如下链接 http://eigen.tuxfamily.org/dox/TopicUnalignedArrayAssert.html 在此不再重复表述。 |
Table of contents
Where in my own code is the cause of the problem?
Cause 1: Structures having Eigen objects as members
Cause 2: STL Containers
Cause 3: Passing Eigen objects by value
Cause 4: Compiler making a wrong assumption on stack alignment (for instance GCC on Windows)
Explanation
I don't care about vectorization, how do I get rid of that stuff?
编译器错误 C2719
Visual Studio 2008其他版本
Visual Studio 2012
Visual Studio 2010
Visual Studio 2005
此主题尚未评级-评价此主题
更新:2007 年 11 月
错误消息
“parameter”: 具有 __declspec(align('#')) 的形参将不被对齐函数参数中不允许使用
align__declspec 修饰符。
下面的示例生成 C2719:
复制
// C2719.cpp void func(int __declspec(align(32)) i); // C2719 // try the following line instead // void func(int i);
相关文章推荐
- command line warning #10006: ignoring unknown option '/NODEFAULTLIB'错误解决(XPDF编译时出现的问题)
- [置顶] win7 && win8 下安装SqlServer 2008出现错误无法将对象实例化的问题
- iis6应用程序池被自动禁用问题 Service Unavailable 应用程序池 'DefaultAppPool' 被自动禁用,原因是为此应用程序池提供服务的进程中出现一系列错误。应用程序-特定 权限设置未将 COM 服务器应用程序(CLSID 为
- win7 && win8 下安装SqlServer 2008出现错误无法将对象实例化的问题
- Python&pip install中出现的asciii码错误的问题
- 关于ASP出现Microsoft VBScript 编译器错误 错误 '800a03f6'等错误
- VC++6.0运行OpenGL 出现错误Cannot open include file: 'GL/glut.h'是什么问题?
- Android开发中遇到的问题(五)——Eclipse导入Android项目出现"Invalid project description overlaps the location of another project"错误的解决办法
- 1.android入门不能忽视的问题之出现“ClassNotFoundException: Didn't find class "...Activity" on path: DexPathLis”错误
- Eigen库对齐问题:declspec(align('16')) 的形参将不被对齐
- 解决VS 中 出现致命错误 RC1015: 无法打开包含文件 'afxres.h' 问题
- 使用Eigen::Matrix4d出现错误:error C2719: “cameraMatrix”: 具有 __declspec(align('16')) 的形参将不被对齐
- 关于android导入工程时出现的@Override错误问题的解决<转>
- 已安全化的ActiveX控件卸载时出现"DllUnregisterServer函数出错,错误代码:0x80070002"问题解决
- 解决了Office2007"向程序发送命令时出现错误 "的问题
- 关于安装.NET Framework 2.0时偶然碰到的问题(提示"Error 205015. 安装程序集..../System.EnterpriseServices.dll失败,原因是出现了系统错误:拒绝访问。")
- [IIS问题类]Service Unavailable错误,'DefaultAppPool' 相关,(应用程序池 'DefaultAppPool' 被自动禁用,原因是为此应用程序池提供服务的进程中出现一系列错误)
- DW中出现 "以下翻译器没有被装载,由于错误:xxxx.htm:有不正确的设置信息" 问题的解决方案
- 在Myeclipse中复制一个没有语法错误及其其他错误项目后再粘贴项目到工作区出现的语法报错问题 关键字:java & web project
- vb+flash 开发常见问题之--保存时出现错误:“系统错误&H80004005(-2147467259),未指定的错误”