[英]Qt - C++ - fatal error C1083: Cannot open include file: 'afx.h'
Here I describe the steps I followed to try to build the following C++ project: 在这里,我描述了尝试构建以下C ++项目的步骤:
http://sourceforge.net/projects/twain-samples/files/TWAIN%202%20Sample%20Application/ http://sourceforge.net/projects/twain-samples/files/TWAIN%202%20Sample%20Application/
On a Microsoft Windows 7 - 64 bit. 在Microsoft Windows 7-64位上。 My ultimate goal is to keep the functionality and to add command-line parameters so I can run it in a batch file, because right now, it's a menu-based software.
我的最终目标是保留功能并添加命令行参数,以便可以在批处理文件中运行它,因为现在,它是一个基于菜单的软件。
Installation of Qt Creator Community 安装Qt Creator社区
Downloading Freeimage library (binary) 下载Freeimage库(二进制)
Installing Freeimage library 安装Freeimage库
Downloading and uncompressing Twain project 下载并解压缩Twain项目
Putting Freeimage header file and lib in the project 将Freeimage头文件和lib放入项目中
Configuration of the project in Qt Creator 在Qt Creator中配置项目
Create and use a string conversion function 创建和使用字符串转换功能
in DSMInterface.cpp source file, add this function: 在DSMInterface.cpp源文件中,添加以下功能:
wchar_t *convertCharArrayToLPCWSTR(const char* charArray) { wchar_t* wString=new wchar_t[4096]; MultiByteToWideChar(CP_ACP, 0, charArray, -1, wString, 4096); return wString; }
in DSMInterface.cpp , function LoadDSMLib , replace 在DSMInterface.cpp中 ,功能LoadDSMLib ,替换
if((gpDSM=LOADLIBRARY(_pszLibName)) != 0)
with 与
if((gpDSM=LOADLIBRARY(convertCharArrayToLPCWSTR(_pszLibName))) != 0)
Compilation - part 1 编译-第1部分
DSMInterface.obj:-1: error : LNK2019: unresolved external symbol "int __cdecl VerifyEmbeddedSignature(wchar_t const *)" (?VerifyEmbeddedSignature@@YAHPEB_W@Z) referenced in function "bool __cdecl LoadDSMLib(char *)" (?LoadDSMLib@@YA_NPEAD@Z)
I added the Twain_App_sample01\\src\\VerifySignature.cpp file to the project and now this message is gone (thanks to Itay Grudev for this) 我将Twain_App_sample01 \\ src \\ VerifySignature.cpp文件添加到项目中,现在此消息消失了( 为此 ,感谢Itay Grudev )
..\\src\\VerifySignature.cpp(13) : fatal error C1083: Cannot open include file: 'afx.h': No such file or directory
In fact I was starting with the Wrong tool. 实际上,我是从错误的工具开始的。 Thanks to Ben who sent me on the right track.
感谢本(Ben )使我走上了正轨。 I needed MFC.
我需要MFC。 So The right solution is to use Visual Studio 2015. I could build it with that.
因此,正确的解决方案是使用Visual Studio2015。我可以以此构建它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.