Category Archives: Library

define/global define

在上面這段code,裡面使用了boost spirit unicode char_class,在預設情況下,如果沒有#define BOOST_SPIRIT_UNICODE 是compile不過的 如果發現在include前面無論如何define都還是找不到定義的話(qi::unicode),要先檢查是否在include前已經有其他include,導致在一開始include因為還未define而沒有include unicode。 這個比較常發生在cpp include B前又include其他header A,在include A裡已經也include B 就會導致這個現象,這時候除了注意include順序問題,也可以透過compile flag設定global define來解決(g++: -D , -D如果沒指定define值時,預設為1)

Posted in Library | Leave a comment

pkg-config整理

config search path: (search for .pc) pkg-config –variable pc_path pkg-config /usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig PKG_CONFIG_PATH 範例 prefix=/usr exec_prefix=${prefix} libdir=/usr/lib/x86_64-linux-gnu includedir=${prefix}/include Name: x264 Description: H.264 (MPEG4 AVC) encoder library Version: 0.148.2643 5c65704 Libs: -L/usr/lib/x86_64-linux-gnu -lx264 Libs.private: -lpthread -lm -ldl Cflags: -I${prefix}/include pkg-config exits with … Continue reading

Posted in Library | Leave a comment

boost library naming

參考: http://www.boost.org/doc/libs/1_66_0/more/getting_started/windows.html#library-naming https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx 另外 boost/config/autolink.hpp裡有提到lib naming的規則 BOOST_LIB_PREFIX + BOOST_LIB_NAME + “_” + BOOST_LIB_TOOLSET + BOOST_LIB_THREAD_OPT + BOOST_LIB_RT_OPT “-” + BOOST_LIB_VERSION On Windows, only ordinary static libraries use the lib prefix; import libraries and DLLs do not. windows上 static library才有lib prefix … Continue reading

Posted in Library | Leave a comment

ffmpeg build on windows

根據 https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC 的說明 這邊使用VS2015, 配合msys 如需要啟用yasm選項 => http://yasm.tortall.net/Download.html download yasm.exe => C:\Windows yasm選項 deprecated WARNING: The –enable-yasm option is only provided for compatibility and will be removed in the future. Use –enable-x86asm / –disable-x86asm instead. msys2 with vs support msys2 … Continue reading

Posted in Library | Leave a comment

sqlite3 compilation

sqlite3 compilation on VS2017 出現 1>sqlite3.c(39053): error C4996: ‘GetVersionExA’: 宣告為已被取代 1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: 請參閱 ‘GetVersionExA’ 的宣告 1>sqlite3.c(39063): error C4996: ‘GetVersionExW’: 宣告為已被取代 1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(442): note: 請參閱 ‘GetVersionExW’ 的宣告 在 sqite3.c加上 #pragma warning(disable: 4996) 即可

Posted in Library | Leave a comment

boost build (visual studio 2015 winxp toolset)

for winxp support 以上是設定compile需要的參數與搜尋順序 (SDK v7.1A first)接下來build boost (這邊沒有使用icu or iconv) bootstrap.bat b2.exe -sBZIP2_SOURCE=D:\build\bzip2-1.0.6 -sZLIB_SOURCE=D:\build\zlib-1.2.11 toolset=msvc define=WINVER=0x0501 define=_WIN32_WINNT=0x0501 define=NTDDI_VERSION=0x05010000 define=PSAPI_VERSION=1 其他的選項 toolset=msvc link=static,shared (.lib or .dll) threading=multi runtime-link=static,shared (/MT or /MD) variant=debug,release address-model=32 or 64 安裝路徑 install –prefix= 其他注意: 需要安裝SDK … Continue reading

Posted in Library | Leave a comment