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文件的規則,它們圍繞着它們和編譯器應該看的地方?
您可能正在打擊默認使用或不使用標準庫的鏈接標誌。快速瀏覽一下。 –
<>搜索路徑 - 「」本地路徑第一 –