当前位置:网站首页>加载dll失败
加载dll失败
2022-07-26 01:01:00 【妙为】
Qt系列文章目录
前言
加载dll失败,使用Dependencies.exe查看,感觉也没有缺失相关dll
在使用Qt中调用别人写的dll,一直加载失败。使用windeployqt.exe命令打包也总是失败
PS E:\osg\work\CARTDLL_demo_20220520\CallCartDll> D:\Qt\Qt5.12.9\5.12.9\msvc2017_64\bin\windeployqt.exe CallCartDll.exe
“CallCartDll.exe” does not exist.
PS E:\osg\work\CARTDLL_demo_20220520\CallCartDll> cd E:\osg\work\CARTDLL_demo_20220520\CallCartDll\debug
PS E:\osg\work\CARTDLL_demo_20220520\CallCartDll\debug> D:\Qt\Qt5.12.9\5.12.9\msvc2017_64\bin\windeployqt.exe CallCartDll.exe
E:\osg\work\CARTDLL_demo_20220520\CallCartDll\debug\CallCartDll.exe 64 bit, debug executable
E:\osg\work\CARTDLL_demo_20220520\CallCartDll\debug\CallCartDll.exe does not seem to be a Qt executable.
PS E:\osg\work\CARTDLL_demo_20220520\CallCartDll\debug>
二、解决办法
1.安装Anaconda3 版本-2021.05-Windows-x86_64
2.设置Anaconda3的环境变量
#include <QCoreApplication>
#include <iostream>
#include "windows.h"
using namespace std;
#pragma comment(lib,"CartDll.lib")
typedef double (*cartfun)(int *itype,int *katmod,int *ikaerosol,int *ikheight,float *iseah,float *ivis,float *irh,
float *wmintemp,float *wmaxtemp,float *avertrans,float *pathradiance, float *totalradiance);
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
HINSTANCE hlib=LoadLibrary(TEXT("CartDll.dll"));
if(!hlib)
{
cout<<"open dll error!"<<endl;
}
else
{
cout<<"open dll sucess!"<<endl;
}
cartfun cart1=(cartfun)GetProcAddress(hlib,"cart");
if(!cart1)
{
cout<<"load CART FUN add error!"<<endl;
}
else
{
cout<<"load CART FUN add sucess!"<<endl;
}
int iType = 3; //计算模式
int iKatmod = 22; //大气模式
int iKaerosol = 1; //气溶胶类型
int iKheight = 0; //气溶胶高度模式
float fSeah = 0.0; //地表海拔高度
float fVis = 34.0; //能见度
float fRh = 65.0; //相对湿度
float fWmintemp = 400.0; //计算起始波数
float fWmaxtemp = 40000.0; //计算截止波数
float fAvertrans;
float fTotalradiance;
float pathradiance;
cart1(&iType,&iKatmod,&iKaerosol,&iKheight,&fSeah,&fVis,&fRh,&fWmintemp,&fWmaxtemp,&fAvertrans,&pathradiance,&fTotalradiance);
cout<<" fAvertrans = "<<fAvertrans<<endl;
cout<<" fTotalradiance = "<<fTotalradiance<<endl;
cout<<" pathradiance = "<<pathradiance<<endl;
cout << "Hello World!" << endl;
std::system("pause");
return a.exec();
}
总结
原来别人写的dll中有用到python相关依赖包,所以要把Anaconda3的路径配置到环境变量中
边栏推荐
- 【软件开发规范三】【软件版本命名规范】
- 《自然语言处理实战入门》深度学习基础 ---- attention 注意力机制 ,Transformer 深度解析与学习材料汇总
- 【RTOS训练营】晚课学员问题
- 代理IP服务器如何保证自身在网络中的信息安全呢
- 【RTOS训练营】课程学习方法和C语言知识(指针、结构体、函数指针、链表)和学员问题
- Timeout settings for feign and hystrix
- 200 yuan a hair dryer, only a week, to achieve 2million?
- [RTOS training camp] operation explanation, queue and ring buffer, queue - transmission data, queue - synchronization tasks and evening class questions
- Processes and threads
- 用 QuestPDF操作生成PDF更快更高效!
猜你喜欢

HCIA comprehensive experiment

Curd used by hyperf

200 yuan a hair dryer, only a week, to achieve 2million?
![[laser principle and application-4]: internal structure and working principle of laser](/img/42/963c151c15c6b633ec0cf633355fb5.jpg)
[laser principle and application-4]: internal structure and working principle of laser

换ip软件的用途很广及原理 动态IP更换的四种方法来保护网络隐私

Win11打不开自带杀毒软件怎么办?win11自带杀毒功能打不开

Open download! Alibaba Devops Practice Manual

ZK-Rollups工作原理

代理IP服务器如何保证自身在网络中的信息安全呢

Unityvr robot Scene 3 gripper
随机推荐
How to choose social e-commerce model in the early stage? Taishan crowdfunding
超全的开源Winform UI库,满足你的一切桌面开发需求!
Embedded development: tips and tricks -- seven tips for designing powerful boot loader
【RTOS训练营】GPIO知识和预习安排 + 晚课提问
【纪中】2022.7.16 1432.输油管道
android sqlite先分组后排序左连查询
How accurate is the IP address? What are dynamic IP and static IP? The most common method of switching IP
We have no way out
[RTOS training camp] problems of evening students
Small sample learning data set
Unity get the animation being played
Lua基础语法
Regular expression
[RTOS training camp] equipment subsystem, questions of evening students
Save unhappiness! My robot psychologist; KPI tracking of machine learning; Pytorch implementation of Yolo V7; Li Hang's new book "machine learning methods" open trial | showmeai Information Daily
Compile openfoam solver with cmake
How jupyter changes the default browser
【Code】剑指offer 03数组中重复的数字
[Code] refers to the repeated number in the offer 03 array
How to switch IP and move bricks with mobile game simulator