Giter Club home page Giter Club logo

learn_cpp's People

Contributors

sibafb avatar

Watchers

 avatar

learn_cpp's Issues

[build][Modern C++ Challenge problem43]undefined reference to `curl_global_init'

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....

[moderncpp problem78] add_custom_command が2つある理由を明らかにする。

Screenshot from 2023-04-28 20-09-08

上記のように実行ファイルの場所にコピーしているように見受けられる。

$<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用のディレクトリのようだ。

同じディレクトリを示すように感じられるが、この違いを考える。

[problem82]undefined reference to `crc32'

/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

時間ライブラリをまとめる

日付と時刻(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

[moderncpp problem77] Segmentation fault (core dumped)

problem77の起動でSegmentation fault (core dumped) が発生した。

Screenshot from 2023-04-27 18-40-16

coredumpを見ると、CalculateTextDimensionsの部分を調査すると
Screenshot from 2023-04-27 18-54-53

上記のCalculateTextDimensionsをたどると、fontの宣言時にArial.ttfのフォントファイルの指定をしているが、
Screenshot from 2023-04-27 18-56-22

このArial.ttfはUbuntu22.04にはない。
Screenshot from 2023-04-27 18-56-39

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.