linux - ubuntu - 编译时找不到共享库

标签 linux boost compilation

我想用这样的语句编译代码:

 c++ -I /usr/boost_1_53_0 boost_test.cpp -o boost \ /usr/lib/boost/libboost_regex.a

但它抛出

c++: error:  /usr/lib/boost/libboost_regex.a: No such file or directory

我确信,libboost_regex.a 存在于上述目录中。 怎么解决呢?我是 ubuntu 和 linux 的新手。 期待您的提示。谢谢。

最佳答案

问题是命令行中包含反斜杠:

c++ -I /usr/boost_1_53_0 boost_test.cpp -o boost \ /usr/lib/boost/libboost_regex.a
                                                  ^
                                                  +-- escaped space character

这个反斜杠转义了以下空格字符,因此路径名实际上是(使用 percent encoding 以获得更好的可读性):

%20/usr/lib/boost/libboost_regex.a

要解决这个问题,只需删除反斜杠字符即可。

关于linux - ubuntu - 编译时找不到共享库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17295469/

相关文章:

linux - kvm 中如何进行设备模拟

linux - rsyslog 发送 IP 地址而不是主机名

c++ - "to_string"是 't a member of "标准”?

C++ boost::spirit 解析嵌入式语言

c++ - boost::shared_ptr 的内容作为 set 的键?

c++ - 在包含中使用定义的值

linux - 为什么使用 g++ 而不是 gcc 来编译 *.cc 文件?

c - 枚举存储在哪里?

windows - 用于我的脚本的通用 mod-rewrite htaccess 文件

c++ - 我如何知道继承 boost::asio::basic_io_object 的类中的 this 成员?