sibafb / learn_cpp Goto Github PK
View Code? Open in Web Editor NEWmy C++ study
my C++ study
pthread_createの参照エラー
以下のようなCMakeの記載方法をメモする場所が必要。
https://cpprefjp.github.io/implementation.html
アイデアベースで。
Ryo Suzuki さんの競プロのための標準C++の学習。
日付と時刻(boost posix time の使用)
http://www.02.246.ne.jp/~torutk/cxx/boost/datetime.html#SEC8
C言語 - 標準ライブラリ - time.h - time_t、struct tm を使用する(秒単位
https://freebsd.sing.ne.jp/lang/c/04/06/02.html
std::time
https://en.cppreference.com/w/cpp/chrono/c/time
iana Time Zone Database
https://www.iana.org/time-zones
C++日本語リファレンス
(chrono)
https://cpprefjp.github.io/reference/chrono.html
(chrono date time utiliry)
https://en.cppreference.com/w/cpp/chrono
problem43の書き換えで、std::formatを使ってみたくなったが、gccだと未実装だということがわかった。
clangを使ってビルドするようにcmakeを書き換える。
https://clang.llvm.org/cxx_status.html
Modern C++ Challenge problem 43の問題を解いていたところ、下記のリンクエラーとなった。
/usr/bin/ld: CMakeFiles/problem43.dir/The-Modern-Cpp-Challenge/libs/date/src/tz.cpp.o: in function `date::curl_global()':
tz.cpp:(.text+0x9fb3): undefined reference to `curl_global_init'
/usr/bin/ld: CMakeFiles/problem43.dir/The-Modern-Cpp-Challenge/libs/date/src/tz.cpp.o: in function `date::(anonymous namespace)::curl_deleter::operator()(void*) const':
tz.cpp:(.text+0xa03a): undefined reference to `curl_easy_cleanup'
/usr/bin/ld: CMakeFiles/problem43.dir/The-Modern-Cpp-Challenge/libs/date/src/tz.cpp.o: in function `date::curl_init()':
tz.cpp:(.text+0xa09d): undefined reference to `curl_easy_init'
/usr/bin/ld: CMakeFiles/problem43.dir/The-Modern-Cpp-Challenge/libs/date/src/tz.cpp.o: in function `date::download_to_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
tz.cpp:(.text+0xa205): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa238): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa260): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa283): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa297): undefined reference to `curl_easy_perform'
/usr/bin/ld: CMakeFiles/problem43.dir/The-Modern-Cpp-Challenge/libs/date/src/tz.cpp.o: in function `date::download_to_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, date::(anonymous namespace)::download_file_options)':
tz.cpp:(.text+0xa426): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa44c): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa488): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa50a): undefined reference to `curl_easy_setopt'
/usr/bin/ld: tz.cpp:(.text+0xa521): undefined reference to `curl_easy_perform'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/problem43.dir/build.make:113: problem43] Error 1
make[1]: *** [CMakeFiles/Makefile2:1507: CMakeFiles/problem43.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
今まで何度か対処した問題だが、generateがstd出ないと言われる問題。
上記のように実行ファイルの場所にコピーしているように見受けられる。
$<TARGET_FILE_DIR:problem_78>
と
${CMAKE_CURRENT_BINARY_DIR}
の違いを調べてみる。
TARGET_FILE_DIRの方は、
https://yuki-koyama.hatenablog.com/entry/2018/09/09/135057
で解説のある通り、TARGETの(ここでいうproblem78)が置かれるの場所のようだ。
CMAKE_CURRENT_BINARY_DIR は
https://theolizer.com/cpp-school3/cpp-school3-12/
の解説や
https://cmake.org/cmake/help/latest/variable/CMAKE_CURRENT_BINARY_DIR.html
のドキュメントが示すとおり、build用のディレクトリのようだ。
同じディレクトリを示すように感じられるが、この違いを考える。
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(png.c.o): in function `png_reset_crc':
png.c:(.text+0x1ea): undefined reference to `crc32'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(png.c.o): in function `png_calculate_crc':
png.c:(.text+0x2ab): undefined reference to `crc32'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(png.c.o): in function `png_reset_zstream':
png.c:(.text+0x17d9): undefined reference to `inflateReset'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(png.c.o): in function `png_compare_ICC_profile_with_sRGB':
png.c:(.text+0x3e6a): undefined reference to `adler32'
/usr/bin/ld: png.c:(.text+0x3e84): undefined reference to `adler32'
/usr/bin/ld: png.c:(.text+0x3ec3): undefined reference to `crc32'
/usr/bin/ld: png.c:(.text+0x3edd): undefined reference to `crc32'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngread.c.o): in function `png_read_destroy':
pngread.c:(.text+0x180a): undefined reference to `inflateEnd'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngrutil.c.o): in function `png_inflate_claim':
pngrutil.c:(.text+0x911): undefined reference to `inflateReset2'
/usr/bin/ld: pngrutil.c:(.text+0x937): undefined reference to `inflateInit2_'
/usr/bin/ld: pngrutil.c:(.text+0x985): undefined reference to `inflateValidate'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngrutil.c.o): in function `png_zlib_inflate':
pngrutil.c:(.text+0xa48): undefined reference to `inflate'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngrutil.c.o): in function `png_decompress_chunk':
pngrutil.c:(.text+0xe7b): undefined reference to `inflateReset'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngwrite.c.o): in function `png_write_destroy':
pngwrite.c:(.text+0x1948): undefined reference to `deflateEnd'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngwutil.c.o): in function `png_deflate_claim':
pngwutil.c:(.text+0x9c1): undefined reference to `deflateEnd'
/usr/bin/ld: pngwutil.c:(.text+0xa51): undefined reference to `deflateReset'
/usr/bin/ld: pngwutil.c:(.text+0xa83): undefined reference to `deflateInit2_'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngwutil.c.o): in function `png_text_compress':
pngwutil.c:(.text+0xd44): undefined reference to `deflate'
/usr/bin/ld: PDF-Writer/LibPng/libLibPng.a(pngwutil.c.o): in function `png_compress_IDAT':
pngwutil.c:(.text+0x1673): undefined reference to `deflate'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/problem82.dir/build.make:103: problem82] Error 1
make[1]: *** [CMakeFiles/Makefile2:244: CMakeFiles/problem82.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Built target PDFWriter
make: *** [Makefile:136: all] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.