2011-06-01 77 views
0

我在編譯我的代碼時遇到了一些問題。有幾個函數由於錯誤C2719而無法編譯 - 具有__declspec(align('16'))的形式參數將不會對齊。頭文件錯誤C2719 - 不使用stl:vector

功能,這VisualStudio中不能編譯看起來像

Eigen::Matrix2d AlgorithmBase::ReverseTransform(Eigen::Vector2d point, Eigen::Vector2d *translation, Eigen::Matrix2d *scaling, double phi, Eigen::Matrix2d *share) 
{ 
    Eigen::Matrix2d reversedScaling; 
    reversedScaling(0,0) = 1/(*scaling)(0,0); 
    reversedScaling(0,1) = reversedScaling(1,0) = 0; 
    reversedScaling(1,1) = 1/(*scaling)(1,1); 
    Eigen::MatrixXd newTranslation = -1**translation; 

    return MatrixHelper::CreateRotationMatrix(-phi)* *scaling*point + newTranslation; 
} 

void TemplateClusterBase::SetScalingMatrix(Eigen::Matrix2d matrix) 
{ 
    if(matrix.rows() == 1 || matrix.cols()==1) 
    { 
     this->scalingMatrix = MatrixHelper::CreateScalingMatrix(matrix(0,0)); 
    } 
    else 
    { 
     this->scalingMatrix = matrix; 
    } 
} 

這很奇怪,因爲以前我用MatrixXd代替的Vector2D和Matrix2d一切都還順利的事實。更多這是使用stl:vector時的常見問題 - 然而正如你可以看到這個函數不作爲參數stl:vector。

我能做些什麼來解決這個問題?

+3

什麼'std :: vector'與什麼有關? – 2011-06-01 22:04:37

+0

在研究如何解決這個問題的過程中,我發現這是使用stl:vector時的常見錯誤 - 至少我認爲:) – george 2011-06-01 22:13:45

+0

Eigen版本2或3? – genpfault 2011-06-01 22:24:47

回答

3

編譯器錯誤C2719與STL無關,它告訴你不允許在形式參數聲明中使用'align'__declspec修飾符。

要解決您的問題,您需要聲明您的函數而不使用__declspec(align(...))。當然,你並沒有明確地使用__declspec,所以你需要弄清楚爲什麼它是代表你使用的。

一個很好的開始可能是Eigen :: Matrix2d的定義。