2015-04-20 29 views
0

在我的項目makefile中,我爲編譯器指定了3個位置以查找#includes。g ++,Xerces 3.1,「memcpy未在此範圍內聲明」

INCLUDES=-I. -I/home/kelly/xerces/xerces-c-3.1.1/src -I/home/kelly/Utilities_New 

當我與在註釋中找到的命令行編譯以下示例代碼:

#include <iostream> 
#include <string> 
#include <sstream> 
#include <iomanip> 
#include <xercesc/util/XMLString.hpp> 

using namespace std; 

/* 
g++ -I. -I/home/kelly/xerces/xerces-c-3.1.1/src -I/home/kelly/Utilities_New test.cpp 
*/ 

int main(int argc, char* argv[]) 
{ 
    cout << "this works" << endl; 
} 

In file included from /home/kelly/Utilities_New/string.h:5:0, 
      from /home/kelly/xerces/xerces-c-3.1.1/src/xercesc/framework/XMLBuffer.hpp:28, 
      from /home/kelly/xerces/xerces-c-3.1.1/src/xercesc/util/XMLString.hpp:26, 
      from test.cpp:7: 
/home/kelly/Utilities_New/defs.h:26:21: fatal error: windows.h: No such file or directory 
compilation terminated. 

顯然編譯器決定,當它處理了Xerces的#includes並在發現string.h中Utilities_New目錄,它已經找到了它所需要的並在那裏停下來。

這個string.h是另一個程序員編寫的,我試圖使用他的庫。

我認爲首先搜索標準位置。我有點迷失在這裏。我可能會錯過一些對你們來說非常明顯的東西。

另外,是不是有一些關於#include文件的規則,它們圍繞着它們和編譯器應該看的地方?

+0

您可能正在打擊默認使用或不使用標準庫的鏈接標誌。快速瀏覽一下。 –

+0

<>搜索路徑 - 「」本地路徑第一 –

回答

0
  1. 最後搜索標準位置。
  2. #include "blah"#include <blah>相同,除非blah與試圖包含它的文件位於同一目錄中。 (除非你使用稀有和gcc特定的-iquote選項)。

欲瞭解更多信息,請參閱here