我正在使用其他人編寫的庫,它基於C++的C++用法 - 我想 - 。在頭文件或源文件中使用的所有內容都採用<>而不是「」形式,即使它們不是標準庫文件。我的編譯器無法識別它們,並返回如何使用<>代替「」包括
問題的一個例子是下面的頭內部錯誤「找不到文件」:
#ifndef _ga_ga_h_
#define _ga_ga_h_
// Make sure that we get the configuration into each of the galib components
// that will be used.
#include <ga/gaconfig.h>
// These are the headers for all of the genetic algorithm classes.
#include <ga/GASimpleGA.h>
#include <ga/GASStateGA.h>
#include <ga/GAIncGA.h>
#include <ga/GADemeGA.h>
#include <ga/GADCrowdingGA.h>
// Here we include the headers for all of the various genome types.
#include <ga/GA1DBinStrGenome.h>
#include <ga/GA2DBinStrGenome.h>
#include <ga/GA3DBinStrGenome.h>
#include <ga/GABin2DecGenome.h>
我包括使用的#include「GA我的計劃裏面這個頭。 h「,但是很難在庫中的每個頭文件/源文件中進行更改。
有沒有辦法讓編譯器使用<>好像它們是「」? 我試圖從項目屬性(我使用Visual Studio)添加「添加包含目錄」的路徑,許多包含的錯誤消失了,但大約30個持續。奇怪的是,他們在一個名爲「c1xx」的文件中,但我沒有該文件!
感謝,
您可以嘗試在編譯器的標頭搜索路徑中添加這些標頭的路徑。如果它能工作或者沒有實現定義。 – Unimportant
如何設置或添加到包含文件的默認搜索路徑取決於編譯器和環境。使用GCC和Clang從命令行使用'-I'(大寫字母i)選項。 –
你使用什麼編譯器? – pstrjds