惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
B
Blog
aimingoo的专栏
aimingoo的专栏
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
月光博客
月光博客
H
Help Net Security
V
Visual Studio Blog
量子位
A
About on SuperTechFans
博客园 - Franky
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog

博客园 - 晨光静默

centos 命令 curl用到的一些命令 nginx记录 html select qq作文 mfc开启控制台打印日记 mfc右键菜单(包括系统托盘菜单)弹窗后如何消失 angular单页应用点击button自动刷新页面 setTimeout中调用angular的作用域生效 mfc模态对话框和非模态对话框注意点 c/c++元转分的bug c/c++中的崩溃代码片段 查看网络端口连接情况 win7x64安装python运行报错:api-ms-win-crt-runtime-|1-1-0.dll SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes python记录 (转)Curl命令详解 开箱即用的clogger 异步重叠IO linux xshell 命令上传下载文件 png转CBitmap
qt导入头文件报错
晨光静默 · 2023-05-10 · via 博客园 - 晨光静默

刚交接同事的qt项目,环境是:

 工程中在源代码引用文件或自己写方法调用到一些外部或系统库,编译会报一大堆错,重复引用等等。这种情况在vc上面是不会出现,搞不懂qt为什么这样,急暂未找到解决方案。尝试了一两天,后来发现不要再原来代码写,单独从工程菜单添加先模块,在新模块里面去写,然后再去引用这个新模块的类。

报错信息:

 利用菜单增加新类模块,模块里再去调用vc++的动态库实现功能

#ifndef CHeader_H
#define CHeader_H

#ifdef __cplusplus
extern "C" {  // 告诉编译器下列代码要以C链接约定的模式进行链接
#endif

    //__stdcall int fnMsgbox(char* msg);


#ifdef __cplusplus
}
#endif

#endif // CHeader_H
#include "CHeader_H.h"
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

extern __stdcall int fnMsgbox(char* msg);

int get(const char* data, int dataLen, char* outdata)
{

#if 1
    typedef int(__stdcall* pmsgbox)(char*);
    HINSTANCE hModule = LoadLibraryA("msgbox.dll");
    if(hModule==NULL)
    {
        MessageBoxA(0,"加载动态库失败","qt",0);
        return -1;
    }
    pmsgbox msgbox = (pmsgbox)GetProcAddress(hModule, "fnMsgbox");
    if(msgbox)
    {
        msgbox("qt调用vc动态库");
    }
    else
    {
        MessageBoxA(0,"加载动态库失败","qt",0);
    }
    FreeLibrary(hModule);
#endif

    return 0;
}