On an x86_64 Debian 10 system I built Codelite from the 13.0 tar.gz file, from the "Download CodeLite 13.0 tar.gz from GitHub" link at https://downloads.codelite.org/. Thanks for this - I prefer a known good body of source code to downloading the current state of the git repository. All the dependency stuff goes very smoothly now, thanks to notes at https://wiki.codelite.org/pmwiki.php/Developers/Linux .
I had all sorts of linker trouble when compiling (GCC 8.3) a simple example program: https://en.cppreference.com/w/cpp/filesystem/path/path , including:
undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()
This was despite adding the two required options for the compiler -std=c++17 and -lstdc++fs . The second must be at or I guess near the end. All the guidance I could find regarding using this library states that it is part of C++17, that GCC 8.x supports it and that since it is not integrated with the main standard library, but is a separate file (for me: /usr/lib/gcc/x86_64-linux-gnu/8/libstdc++fs.a) that this special option was needed so g++ would instruct the linker to link this library in.
I found it didn't matter whether the library file was there or not. I also found that when it is there, a plain g++ command line with these two options compiled and linked the program just fine.
The problem was that adding these to options to: "Project (right click) > Settings > Compiler > C++ Compiler Options" only affected the one or more command lines which Codelite generates to make g++ compile the one or more items of source code. What is required, in addition, is adding -lstdc++fs to the item below: Project (right click) > Settings > Linker > Linker Options .
I read that the need for this option is only for GCC 8.x and that with 9.x there will be no need for it.
I haven't used this library to any significant degree yet. I am working from the https://en.cppreference.com/w/cpp/filesystem/ pages and I found a tutorial at the Boost site https://www.boost.org/doc/libs/1_70_0/l ... /index.htm from which this library originated. However, the two libraries are different in some ways: https://github.com/boostorg/filesystem/issues/88 , https://www.bfilipek.com/2017/08/cpp17- ... system.htm and https://www.bfilipek.com/2019/05/boost-to-stdfs.html .
As always, thanks for Codelite!
Linker troubles with C++17 filesystem library
-
- CodeLite Enthusiast
- Posts: 14
- Joined: Sat Mar 26, 2011 4:22 pm
- Genuine User: Yes
- IDE Question: C++
- Contact: