当 LIBS += -L"..." 似乎不起作用时,如何在 Qt Creator 中链接外部库?

如何解决当 LIBS += -L"..." 似乎不起作用时,如何在 Qt Creator 中链接外部库?

我一直在尝试在我的代码中使用 Intel Open Image Denoise 库,但到目前为止仍然没有运气。显然,我似乎没有正确链接库。

这是我到目前为止所做的:在编译 OIDN 后,我将 oidn 目录移动到我的路径跟踪代码所在的目录,并在我正在 Qt 中处理的代码 (C++11) 中执行以下操作创作者。

#include "oidn/include/OpenImageDenoise/oidn.hpp"
.
.
.
oidn::DeviceRef device = oidn::newDevice(); // this is where things break
device.commit();

请注意,执行 #include "oidn/include/OpenImageDenoise/oidn.hpp" 似乎工作正常,因为自动完成功能适用于 oidn 并显示其成员。但是,我收到以下错误,这似乎是由于未链接 oidn 库所致。

enter image description here

我尝试通过 LIBS += -L"oidn/build/"LIBS += -L"oidn/build/libOpenImageDenoise.so"(如图所示)链接库,但出现相同的错误。我还附加了 -loidn,但出现错误提示 "cannot find -loidn"。我现在很困惑我应该做什么。我什至不确定错误是否是由于没有正确链接库造成的,因为我看到人们通常以与我在这里尝试的方式相同的方式链接 C++ 中的库。如果有人能帮助我弄清楚我需要做什么才能让 OIDN 工作,我将不胜感激。

解决方法

-L 后面必须跟一个目录。您要查找的实际上是 -l

,

之前的所有答案/评论都是正确的。关于我的案例的奇怪之处在于 build 目录中库的符号链接无效并且没有指向正确的文件。 ls -lh /home/Warrior/Desktop/pathtracer/oidn/build 的输出如下:

total 160K
drwxrwxr-x 4 amir amir 4.0K Feb  4 00:09 apps
-rw-rw-r-- 1 amir amir  19K Feb  4 00:09 CMakeCache.txt
drwxrwxr-x 7 amir amir 4.0K Feb  4 00:09 CMakeFiles
-rw-rw-r-- 1 amir amir 6.5K Feb  4 00:09 cmake_install.cmake
drwxrwxr-x 3 amir amir 4.0K Feb  4 00:09 common
-rw-r--r-- 1 amir amir 3.6K Feb  4 00:09 CPackConfig.cmake
-rw-r--r-- 1 amir amir 4.0K Feb  4 00:09 CPackSourceConfig.cmake
-rw-rw-r-- 1 amir amir 103K Feb  4 00:09 Makefile
drwxrwxr-x 3 amir amir 4.0K Feb  4 00:08 mkl-dnn
-rw-r--r-- 1 amir amir 1.6K Feb  4 00:09 OpenImageDenoiseConfigVersion.cmake

但是当我转到目录时,我会看到以下内容:

enter image description here

我所做的不是在其他地方克隆 oidn 存储库并构建它,而是在 /home/Warrior/Desktop/pathtracer/ 中克隆了 oidn 存储库并在那里构建它。之后,我可以通过 ls -lh 看到正确的文件名/符号链接,如下所示。现在我的程序可以编译并且一切正常。我只需要在编译代码时使用 LIBS += -L"oidn/build/" -lOpenImageDenoise

total 51M
drwxrwxr-x 4 amir amir 4.0K Feb  9 10:14 apps
-rw-rw-r-- 1 amir amir  19K Feb  9 10:14 CMakeCache.txt
drwxrwxr-x 7 amir amir 4.0K Feb  9 10:19 CMakeFiles
-rw-rw-r-- 1 amir amir 5.6K Feb  9 10:14 cmake_install.cmake
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 color_ispc_avx2.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 color_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 3.1K Feb  9 10:17 color_ispc.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 color_ispc_sse4.h
drwxrwxr-x 3 amir amir 4.0K Feb  9 10:14 common
-rw-r--r-- 1 amir amir 3.3K Feb  9 10:14 CPackConfig.cmake
-rw-r--r-- 1 amir amir 3.7K Feb  9 10:14 CPackSourceConfig.cmake
-rw-rw-r-- 1 amir amir 2.6K Feb  9 10:17 input_reorder_ispc_avx2.h
-rw-rw-r-- 1 amir amir 2.6K Feb  9 10:17 input_reorder_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 3.1K Feb  9 10:17 input_reorder_ispc.h
-rw-rw-r-- 1 amir amir 2.6K Feb  9 10:17 input_reorder_ispc_sse4.h
-rw-rw-r-- 1 amir amir  41K Feb  9 10:14 libcommon.a
-rw-rw-r-- 1 amir amir  16M Feb  9 10:17 libdnnl.a
lrwxrwxrwx 1 amir amir   24 Feb  9 10:19 libOpenImageDenoise.so -> libOpenImageDenoise.so.0
lrwxrwxrwx 1 amir amir   28 Feb  9 10:19 libOpenImageDenoise.so.0 -> libOpenImageDenoise.so.1.3.0
-rwxrwxr-x 1 amir amir  34M Feb  9 10:19 libOpenImageDenoise.so.1.3.0
-rw-rw-r-- 1 amir amir  37K Feb  9 10:19 libutils.a
drwxrwxr-x 2 amir amir 4.0K Feb  9 10:17 local__core
-rw-rw-r-- 1 amir amir 104K Feb  9 10:14 Makefile
drwxrwxr-x 3 amir amir 4.0K Feb  9 10:14 mkl-dnn
-rwxrwxr-x 1 amir amir 181K Feb  9 10:19 oidnBenchmark
-rwxrwxr-x 1 amir amir  59K Feb  9 10:19 oidnDenoise
-rwxrwxr-x 1 amir amir 882K Feb  9 10:19 oidnTest
-rw-r--r-- 1 amir amir 1.6K Feb  9 10:14 OpenImageDenoiseConfigVersion.cmake
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 output_copy_ispc_avx2.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 output_copy_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 1.9K Feb  9 10:17 output_copy_ispc.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 output_copy_ispc_sse4.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 output_reorder_ispc_avx2.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 output_reorder_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 3.1K Feb  9 10:17 output_reorder_ispc.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 output_reorder_ispc_sse4.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 upsample_ispc_avx2.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 upsample_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 1.8K Feb  9 10:17 upsample_ispc.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 upsample_ispc_sse4.h
drwxrwxr-x 2 amir amir 4.0K Feb  9 10:17 weights

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-