2013-11-01 128 views
1

我在Visual Studio 2010(C++項目)中有一個項目,它在調試模式下編譯時沒有問題,但在發佈模式下給我一個奇怪的「語法」錯誤洪流。錯誤是這樣的:發佈模式下的Visual Studio C++ 2010編譯錯誤

c:\program files\point grey research\flycapture2\include\Error.h(38): error C2059: syntax error : 'string' 
1>c:\program files\point grey research\flycapture2\include\Error.h(39): error C2146: syntax error : missing ';' before identifier 'Error' 
1>c:\program files\point grey research\flycapture2\include\Error.h(39): error C2470: 'Error' : looks like a function definition, but there is no parameter list; skipping apparent body 
1>c:\program files\point grey research\flycapture2\include\BusManager.h(56): error C2059: syntax error : 'string' 
1>c:\program files\point grey research\flycapture2\include\BusManager.h(57): error C2146: syntax error : missing ';' before identifier 'BusManager' 

FlyCapture是我的代碼使用的庫。我仔細檢查了包含的頭文件目錄和lib庫的路徑,它們是正確的。我還更改了庫文件名,使它們不包含「d」(用於調試)。我還檢查了預編譯器_DEBUG語句的代碼。我沒有找到一個。這非常令人沮喪。任何想法我應該檢查什麼?我正在編譯x64模式。

編輯:

第一個錯誤指向下方粘貼庫頭文件「類FLYCAPTURE2_API錯誤」線(我甚至沒寫這個庫自己和它在調試模式下工作):

namespace FlyCapture2 
{ 
    struct ErrorImpl; 

    /** 
    * The Error object represents an error that is returned from the library. 
    * Overloaded operators allow comparisons against other Error objects or 
    * the ErrorType enumeration. 
    */ 
    class FLYCAPTURE2_API Error 
    { 
    public: 

     /** 
     * Default constructor. 
     */ 
     Error(); 

     /** 
     * Copy constructor. 
     */ 
     Error(const Error& error); 

     /** 
     * Default destructor. 
     */ 
     virtual ~Error(); 

這對我來說很奇怪。這段代碼應該沒有問題。

+0

你能至少粘貼發生錯誤的行(及其周圍環境)嗎? –

+0

我添加了第一條錯誤消息指向的代碼段,如果有幫助的話。謝謝。 – pkout

+1

@pkout很明顯,調試和發佈模式將會有不同的設置。你將不得不四處挖掘,看看有哪些變化。 – 2013-11-01 16:07:31

回答

1

我明白了。我能夠找到FlyCapture2庫配置的編譯版本模式下的示例項目。它包含幾個與調試模式不同的開關。所以我的路徑是正確的,但有一些編譯器開關和庫忽略啓用。如果使用FlyCapture2的人遇到這種情況,請參閱示例項目並將其切換到發佈模式,然後將項目的發佈模式與他們的發佈模式進行比較。感謝你們!