- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将一个项目链接到 Ubuntu 13.04 上的 boost:filesystem,但在最后阶段我遇到了一些奇怪的链接错误。
构建配置是通过 cmake 完成的:
find_package(Boost COMPONENTS system filesystem program_options REQUIRED )
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
target_link_libraries(${YARS_TARGET} yarsLib GLEW GL GLU glut m dl xerces-c ode ${Boost_LIBRARIES})
我尝试使用不同的 boost 版本。对于 1.49 和 1.53,我有相同的行为。在 Ubuntu 12.04 上,它确实可以正常工作,而在我运行 Archlinux 和 boost 1.53 的开发机器上,它编译、链接和运行都很好。
/usr/bin/g++ -O3 CMakeFiles/yars.dir/yarsMain.o -o ../bin/yars
-L/home/vagrant/local/lib -rdynamic ../lib/libyarsLib.a -lGLEW -lGL -lGLU
-lglut -lm -ldl -lxerces-c -lode -lboost_system
-lboost_filesystem -lboost_program_options
../lib/libsensorLib.a ../lib/libenvironmentLib.a ../lib/libutilLib.a ../lib/libutilFilterLib.a ../lib/libutilFormatLib.a ../lib/libutilFunctionGeneratorLib.a ../lib/libutilIoLib.a ../lib/libutilMathLib.a ../lib/libutilDefineLib.a ../lib/libdescriptionLib.a ../lib/libfilterDescriptionLib.a ../lib/libfunctionGeneratorDescriptionLib.a ../lib/libfunctionGeneratorDescriptionUtilLib.a ../lib/libbioDescriptionLib.a ../lib/libsensorsDescriptionLib.a ../lib/libyarsDirectoriesModel.a -Wl,-rpath,/home/vagrant/local/lib:
../lib/libutilIoLib.a(FileSystemOperations.o):
In function `FileSystemOperations::doesDirExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x27): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x3a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesFileExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x67): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x7a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesDirExist(std::string*)':
FileSystemOperations.cpp:(.text+0xca): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xdf): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingDir(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x2c3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x35e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x373): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x403): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x43b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x453): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x50d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x564): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingFile(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x7e3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x87e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x893): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x923): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x95b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x973): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa2d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa84): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDir(std::vector<std::string, std::allocator<std::string> >)':
FileSystemOperations.cpp:(.text+0xd53): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xd68): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPath(std::string*, bool, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1100): undefined reference to `boost::filesystem::detail::initial_path(boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x1124): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x11e9): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1237): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x130a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x131f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x137b): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x13dc): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPathFromAlternatives(std::string*, std::string*, std::vector<std::string, std::allocator<std::string> >*, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1635): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1699): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x16d0): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x173f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
最佳答案
只是一个建议:
1) 检查你的 boost 库是否包含所需的符号,你可以使用这样的东西:nm -D/usr/lib64/libboost_filesystem.so.1.52.0 |详细信息 | C++过滤器 | grep 你的名字
2)尝试更改链接库的顺序,例如将 -lboost_bla-bla-bla 放在命令行的末尾,然后再次使用 g++ 运行此命令,不要使用 make 或其他东西,只需复制粘贴命令并进行实验与它。
关于c++ - 在 Ubuntu 13.04 上链接 boost::filesystem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17560057/
有没有办法确定我是否可以使用标准 (在所有支持 C++17 的现代 C++ 编译器上可用)或 由较旧的编译器使用。 (例如 g++ 6.3,这是 Debian Stretch 上的当前标准版本) 知
因此,boost::filesystem 允许您在文件所有者拥有的权限、组拥有的权限以及所有用户拥有的权限的意义上访问文件的权限。这很好,但我不想开始检查我是谁,我的组是什么等等——我只想检查我是否可
我不小心使用 rm -rf 删除了错误的文件夹,我尝试过的每个工具都告诉我我没有硬盘或找不到文件系统。 当我输入 df 时,我得到: 已使用的文件系统大小 Avail Use% Mounted on
我是 Java 的新手,正在尝试学习 IO 的概念。我遇到过两个非常相似的 Java 类,FileSystem 和 FileSystems。它们之间有什么区别?什么时候使用一个而不是另一个? 最佳答案
我查了很多关于c++17下文件系统链接的问题,还是无法链接成功。我的main.cpp文件如下。 #include int main(int argc, char** argv) { std:
Boost 库有一个类来处理文件路径:boost::filesystem::path。Boos 也有这个类 boost::filesystem::wpath 每个类都有方法string(), wstr
我正在编写一个利用 std::filesystem 的库(仅供学习)。它在 MSVC 上运行良好,但是默认情况下,Linux 的 LTS 版本就像 Ubuntu 一样附带 GCC 6.x,官方存储库中
请查找随附的代码片段。我正在使用此代码将文件从 hdfs 下载到我的本地文件系统 - Configuration conf = new Configuration(); FileSys
这段代码中std::filesystem::copy()和std::filesystem::copy_file()有什么区别? #include void testing() { const
以下代码旨在去除路径的第一部分,以防它存在: #include std::filesystem::path strip_prefix(std::filesystem::path p) {
在以下两种情况下,是否有理由调用lexically_normal: std::filesystem::path filepath = someFuntionThatGetsAPath(); filep
函数 boost::filesystem::canonical() ( doc of 1.66 , doc of current release ) 提供两个参数(忽略错误代码重载)base。第一个是
boost::filesystem::path使用 &转义路径字符串中的引号,see demo : std::cout 标题。 最佳答案 Boost::Filesystem 相当古老,早于 C++14
考虑以下关于路径分解的断言,其中每个局部变量,例如stem 具有明显的初始化,例如auto stem = path.stem() — assert(root_path == root_name / r
给定以下代码: fs::path p{ "a/b/" }; fs::path q{ "a/b/." }; assert(p == q); [注意定义 q 的字符串末尾的额
由于 C++17 std::filesystem 与 boost::filesystem 非常相似,所以我尝试做与这个问题相同的事情: Escaping some Directories in ite
我找到了这个页面,描述了 c++14 和 c++17 之间的变化: https://isocpp.org/files/papers/p0636r0.html ... 它链接到此页面,该页面描述了建议的
我有一些代码,当我编译它时,出现以下错误,我不知道如何解决。我尝试添加 -L/usr/lib/x86_64-linux-gnu、-lboost_system 和 -lboost_filesystem,
尝试使用 Asset.loadAsync 将 .txt Assets 作为字符串加载到 Expo 中 Asset.loadAsync(module) 解析并提供一个 localUri 但是,FileS
我在 中编码C++ 在 Visual Studio (Windows 10)并收到此错误: #error The header providing std::experimental::filesy
我是一名优秀的程序员,十分优秀!