BrunoLevy / geogram

a programming library with geometric algorithms
Other
1.9k stars 129 forks source link

static linking #77

Closed xiaolonghe7 closed 1 year ago

xiaolonghe7 commented 1 year ago

Hi, I try to compile a program (in VS without Cmake) that is statically linked to the geogram library in a Windows platform, but got following compilation errors. It seems that they are related to the complication settings, but I could not figure out where goes wrong. Do you have any ideas about these errors? I appreciate your time and help! Thank you very much!

2>main.cpp 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(38,24): error C2061: syntax error: identifier 'streampos' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(218,2): message : see reference to class template instantiation 'std::_Char_traits<_Elem,_Int_type>' being compiled 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(39,24): error C2061: syntax error: identifier 'streamoff' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(229,24): error C2061: syntax error: identifier 'streampos' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(330,2): message : see reference to class template instantiation 'std::_WChar_traits<_Elem>' being compiled 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(230,24): error C2061: syntax error: identifier 'streamoff' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(364,24): error C2061: syntax error: identifier 'streampos' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(491,2): message : see reference to class template instantiation 'std::_Narrow_char_traits<_Elem,_Int_type>' being compiled 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(365,24): error C2061: syntax error: identifier 'streamoff' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(505,14): error C2988: unrecognizable template declaration/definition 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(505,14): error C2143: syntax error: missing ';' before '<' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(505,14): error C2059: syntax error: '<' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(506,89): error C2143: syntax error: missing ';' before '{' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(506,89): error C2447: '{': missing function header (old-style formal list?) 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(2447,27): error C2143: syntax error: missing ';' before '<' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5047,2): message : see reference to class template instantiation 'std::basic_string<_Elem,_Traits,_Alloc>' being compiled 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(2447,1): error C2433: 'std::basic_stringbuf': 'friend' not permitted on data declarations 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(2447,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(2447): error C2238: unexpected token(s) preceding ';' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5317,14): error C2988: unrecognizable template declaration/definition 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5317,14): error C2143: syntax error: missing ';' before '<' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5317,14): error C2059: syntax error: '<' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,56): error C2065: '_Elem': undeclared identifier 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,63): error C2065: '_Traits': undeclared identifier 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,72): error C2065: '_Alloc': undeclared identifier 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,43): error C2923: 'std::basic_string': '_Elem' is not a valid template type argument for parameter '_Elem' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,56): message : see declaration of '_Elem' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,43): error C2923: 'std::basic_string': '_Traits' is not a valid template type argument for parameter '_Traits' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,63): message : see declaration of '_Traits' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,43): error C2923: 'std::basic_string': '_Alloc' is not a valid template type argument for parameter '_Alloc' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,72): message : see declaration of '_Alloc' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,87): error C2143: syntax error: missing ';' before '{' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5318,87): error C2447: '{': missing function header (old-style formal list?) 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5366,14): error C2988: unrecognizable template declaration/definition 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5366,14): error C2143: syntax error: missing ';' before '<' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5366,14): error C2059: syntax error: '<' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,62): error C2065: '_Elem': undeclared identifier 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,69): error C2065: '_Traits': undeclared identifier 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,78): error C2065: '_Alloc': undeclared identifier 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,49): error C2923: 'std::basic_string': '_Elem' is not a valid template type argument for parameter '_Elem' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,62): message : see declaration of '_Elem' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,49): error C2923: 'std::basic_string': '_Traits' is not a valid template type argument for parameter '_Traits' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,69): message : see declaration of '_Traits' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,49): error C2923: 'std::basic_string': '_Alloc' is not a valid template type argument for parameter '_Alloc' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,78): message : see declaration of '_Alloc' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,93): error C2143: syntax error: missing ';' before '{' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xstring(5367,93): error C2447: '{': missing function header (old-style formal list?) 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\ctype.h(257,20): error C3861: '_isctype_l': identifier not found 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(22,25): error C2039: 'isalnum': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(22,13): error C2873: 'isalnum': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(23,25): error C2039: 'isalpha': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(23,13): error C2873: 'isalpha': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(24,25): error C2039: 'iscntrl': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(24,13): error C2873: 'iscntrl': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(25,25): error C2039: 'isdigit': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(25,13): error C2873: 'isdigit': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(26,25): error C2039: 'isgraph': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(26,13): error C2873: 'isgraph': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(27,25): error C2039: 'islower': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(27,13): error C2873: 'islower': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(28,25): error C2039: 'isprint': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(28,13): error C2873: 'isprint': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(29,25): error C2039: 'ispunct': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(29,13): error C2873: 'ispunct': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(30,25): error C2039: 'isspace': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(30,13): error C2873: 'isspace': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(31,25): error C2039: 'isupper': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(31,13): error C2873: 'isupper': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(32,25): error C2039: 'isxdigit': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(32,13): error C2873: 'isxdigit': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(33,25): error C2039: 'tolower': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(33,13): error C2873: 'tolower': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(34,25): error C2039: 'toupper': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(34,13): error C2873: 'toupper': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(36,25): error C2039: 'isblank': is not a member of 'global namespace'' 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\cctype(36,13): error C2873: 'isblank': symbol cannot be used in a using-declaration 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\string(26,14): error C2988: unrecognizable template declaration/definition 2>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\string(26): fatal error C1003: error count exceeds 100; stopping compilation 2>Done building project "test.vcxproj" -- FAILED.

BrunoLevy commented 1 year ago

I'd recommend using CMake and the CMakefiles included in geogram (then you can generate static libraries, it is the default).

BrunoLevy commented 1 year ago

Hi, It is difficult for me to help with just this information, Would you provide a minimal example that has the problem ? (See #90 and its attached minimal example for an example).

xiaolong7 commented 1 year ago

Hi, It is difficult for me to help with just this information, Would you provide a minimal example that has the problem ? (See #90 and its attached minimal example for an example).

Hi, thank you for your reply. The issue has been resolved.

BrunoLevy commented 1 year ago

Thanks ! I am closing the issue then. Do not hesitate to re-open it (or another one) if you encounter other difficulties.