bundler-sfm windows下編譯過程當中出現的錯誤

 

1、「sysdep1.h」文件缺失

錯誤提示:c++

fatal error C1083: 沒法打開包括文件: 「sysdep1.h」: No such file or directory

這些做爲這個軟件的bug, 不須要太清楚爲何形成這種錯誤。只須要更正過來便可。你的經歷應該放在對算法的理解上去。算法

 

解決方法:windows

在bundler源碼根目錄下的\lib\f2c中:bash

1>將sysdep1.h0文件名修改成sysdep1.h函數

2>將signal1.h0文件名修改成signal1.hthis

3>新建一個arith.h文件(建立頭文件頭只需將文件名定義爲arith),這自己是個頭文件(注意區別裏面的cpp文件),在文件裏添加以下內容便可:.net

#define IEEE_8087
#define Arith_Kind_ASL 1
#define Long int
#define Intcast (int)(long)
#define Double_Align
#define X64_bit_pointers
#define QNaN0 0x0
#define QNaN1 0xfff80000blog

 

2、<hash_map> is deprecated and will be REMOVED

提示:ip

hash_map(17): fatal error C1189: #error:  <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

 

緣由:get

正如所提示的那樣,是static assertion failed with "<hash_map> is deprecated and will be REMOVED.

解決方法:

一、在bundler的項目屬性下,增長一個定義, /D _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 。(推薦)

二、在使用include<hash_map>以前,加上#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS定義。(不推薦,比較繁複。)

三、使用unordered_map代替hash_map

以上三種方法任選其一。

 

3、「int32_t」: 重定義

錯誤提示:

src\include\types.h(6): error C2371: 「int32_t」: 重定義;不一樣的基類型

解釋:

源碼中的include\types.h裏的ypedef signed long int32_t定義,與

Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\stdint.h

中的int32_t定義衝突了,並且其實也不是一個含義。

 

解決:

將typedef signed long int32_t這個定義中的int32_t,改成int32_st。並修改VS解決方案裏的全部引用。

 

4、「_isnan」: 不是「std」的成員

提示:

\bundleadd.cpp(352): error C2039: 「_isnan」: 不是「std」的成員

 

解決:

去掉_isnan前面的std::便可。

 

5、沒法解析的外部符號GetVectorIntersection

提示:

1>BaseGeometry.obj : error LNK2019: 沒法解析的外部符號 "class std::vector<int,class std::allocator<int> > __cdecl GetVectorIntersection(class std::vector<int,class std::allocator<int> > const &,class std::vector<int,class std::allocator<int> > const &)" (?GetVectorIntersection@@YA?AV?$vector@HV?$allocator@H@std@@@std@@ABV12@0@Z),該符號在函數 "public: bool __thiscall BaseApp::ImagesPartOfPanorama(int,int)" (?ImagesPartOfPanorama@BaseApp@@QAE_NHH@Z) 中被引用
1>ImageData.obj : error LNK2001: 沒法解析的外部符號 "class std::vector<int,class std::allocator<int> > __cdecl GetVectorIntersection(class std::vector<int,class std::allocator<int> > const &,class std::vector<int,class std::allocator<int> > const &)" (?GetVectorIntersection@@YA?AV?$vector@HV?$allocator@H@std@@@std@@ABV12@0@Z)
1>MatchTracks.obj : error LNK2001: 沒法解析的外部符號 "class std::vector<int,class std::allocator<int> > __cdecl GetVectorIntersection(class std::vector<int,class std::allocator<int> > const &,class std::vector<int,class std::allocator<int> > const &)" (?GetVectorIntersection@@YA?AV?$vector@HV?$allocator@H@std@@@std@@ABV12@0@Z)
1>BundleIO.obj : error LNK2019: 沒法解析的外部符號 "bool __cdecl FileExists(char const *)" (?FileExists@@YA_NPBD@Z),該符號在函數 "public: void __thiscall BaseApp::ReadCameraConstraints(void)" (?ReadCameraConstraints@BaseApp@@QAEXXZ) 中被引用
1>BundlerGeometry.obj : error LNK2001: 沒法解析的外部符號 "bool __cdecl FileExists(char const *)" (?FileExists@@YA_NPBD@Z)
1>ImageData.obj : error LNK2001: 沒法解析的外部符號 "bool __cdecl FileExists(char const *)" (?FileExists@@YA_NPBD@Z)
1>BundlerApp.obj : error LNK2019: 沒法解析的外部符號 "void __cdecl Tokenize(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Tokenize@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@0@Z),該符號在函數 "public: virtual void __thiscall BundlerApp::ProcessOptions(int,char * *)" (?ProcessOptions@BundlerApp@@UAEXHPAPAD@Z) 中被引用
1>ImageData.obj : error LNK2001: 沒法解析的外部符號 "void __cdecl Tokenize(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Tokenize@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@0@Z)
1>BundleTwo.obj : error LNK2019: 沒法解析的外部符號 "void __cdecl generate_permutation(int,int *)" (?generate_permutation@@YAXHPAH@Z),該符號在函數 "void __cdecl PermuteMatches(class std::vector<class KeypointMatch,class std::allocator<class KeypointMatch> > &)" (?PermuteMatches@@YAXAAV?$vector@VKeypointMatch@@V?$allocator@VKeypointMatch@@@std@@@std@@@Z) 中被引用
1>ImageData.obj : error LNK2019: 沒法解析的外部符號 "struct img_t * __cdecl RescaleImage(struct img_t *,int,double &)" (?RescaleImage@@YAPAUimg_t@@PAU1@HAAN@Z),該符號在函數 "public: void __thiscall ImageData::LoadThumb256(void)" (?LoadThumb256@ImageData@@QAEXXZ) 中被引用
1>ImageData.obj : error LNK2019: 沒法解析的外部符號 "void __cdecl GetRotationFromSpherical(double,double,double *)" (?GetRotationFromSpherical@@YAXNNPAN@Z),該符號在函數 "public: void __thiscall ImageData::DetectLineSegments(double,double,double,double)" (?DetectLineSegments@ImageData@@QAEXNNNN@Z) 中被引用
1>E:\Projs\algs\bundler\src\vc++\Debug\Bundler.exe : fatal error LNK1120: 6 個沒法解析的外部命令

 

問題剖析:

這種沒法識別的外部符號,是VS編譯過程當中常見的錯誤。解決思路通常爲:

檢查第三方庫的lib是否Debug、Release、x8六、x64 版本正確;

檢查是否引用了合適的lib庫;

檢查當前項目中,本身定義的類庫中,是否僅僅加入VS Project的僅有xxx.h文件,而沒有.cpp文件。

而此處出現的錯誤,就是屬於最後面的那一種狀況。將src\BundleUtil.cpp找到,並加入Bundler中。

 

 

 

 

參考

windows7下實現Bundler,PMVS,CMVS在VS2010/VS2013上的編譯並經過cygwin運行(1). 2016.11

VS2015靜態斷言失敗How to fix hash_map is deprecated and will be REMOVED,2019.6

相關文章
相關標籤/搜索