简体   繁体   English

Qt-C ++-致命错误C1083:无法打开包含文件:'afx.h'

[英]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. 我的最终目标是保留功能并添加命令行参数,以便可以在批处理文件中运行它,因为现在,它是一个基于菜单的软件。

  1. Installation of Qt Creator Community 安装Qt Creator社区

    • Version 3.5.0 (based on Qt 5.5.0 (MSVC 2013, 32 bit) 版本3.5.0(基于Qt 5.5.0(MSVC 2013,32位)
    • Kits available: 可用套件:
      • Desktop Qt 5.4.2 MSVC2013 64bit2 桌面Qt 5.4.2 MSVC2013 64bit2
      • Desktop Qt 5.5.0 MSVC2010 32bit 台式机Qt 5.5.0 MSVC2010 32位
      • Desktop Qt 5.5.0 MSVC2012 32bit 台式机Qt 5.5.0 MSVC2012 32位
      • Desktop Qt 5.5.0 MSVC2013 32bit 桌面Qt 5.5.0 MSVC2013 32位
      • Desktop Qt 5.5.0 MSVC2013 64bit 桌面Qt 5.5.0 MSVC2013 64位
  2. Downloading Freeimage library (binary) 下载Freeimage库(二进制)

  3. Installing Freeimage library 安装Freeimage库

    • Uncompress FreeImage3170Win32Win64.zip 解压缩FreeImage3170Win32Win64.zip
    • open the folder FreeImage\\Dist\\x64 打开文件夹FreeImage \\ Dist \\ x64
    • Copy freeimage.dll in the C:\\Windows\\System32 folder freeimage.dll复制到C:\\ Windows \\ System32文件夹中
  4. Downloading and uncompressing Twain project 下载并解压缩Twain项目

  5. Putting Freeimage header file and lib in the project 将Freeimage头文件和lib放入项目中

    • copy Freeimage.h in the common folder 复制Freeimage.h公共文件夹
    • create a lib folder in Twain_App_sample01\\src folder Twain_App_sample01 \\ src文件夹中创建一个lib文件夹
    • copy freeimage.lib in Twain_App_sample01\\src\\lib folder 复制Twain_App_sample01 \\ src \\ lib文件夹中的freeimage.lib
  6. Configuration of the project in Qt Creator 在Qt Creator中配置项目

    • launch Qt Creator 启动Qt Creator
    • in Qt, click Open project 在Qt中,单击“ 打开项目”
    • choose the file src.pro in the Twain_App_sample01\\src folder Twain_App_sample01 \\ src文件夹中选择文件src.pro
    • in Configure Project choose the Kit Desktop Qt 5.5.0 MSVC2013 64bit Configure Project中选择Kit Desktop Qt 5.5.0 MSVC2013 64bit
    • click the Configure project button 单击配置项目按钮
  7. 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) 
  8. Compilation - part 1 编译-第1部分

    • Now i get a message from the linker: 现在我从链接器收到一条消息:

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

  1. Compilation - part 2 编译-第2部分
    • I have another message now 我现在有另一条消息

..\\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.

相关问题 Matlab符合C ++文件错误:致命错误C1083:无法打开包含文件:'stdafx.h' - Matlab complies C++ file error: fatal error C1083: Cannot open include file: 'stdafx.h' 将Matlab编译为C ++问题:致命错误C1083:无法打开包含文件:Windows.h - Compiling Matlab to C++ Problem: fatal error C1083: Cannot open include file: 'windows.h' SWIG致命错误C1083:无法打开包含文件 - SWIG Fatal error C1083: Cannot open include file QtCreator中的“致命错误C1083:无法打开包含文件” - “Fatal Error C1083: Cannot open include file” in QtCreator 严重错误C1083:无法打开包含文件:'mexutils.h':没有此类文件或目录 - fatal error C1083 : Cannot open include file: 'mexutils.h': No such file or directory 严重错误C1083:无法打开包含文件:“ Item.h”':没有此类文件或目录 - fatal error C1083: Cannot open include file: 'Item.h”': No such file or directory 致命错误 C1083:无法打开包含文件:'fstream.h':没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'fstream.h': No such file or directory 严重错误C1083:无法打开包含文件:'vld.h':没有此类文件或目录 - fatal error C1083: Cannot open include file: 'vld.h': No such file or directory 致命错误 C1083:无法打开包含文件:“xyz.h”:没有这样的文件或目录? - fatal error C1083: Cannot open include file: 'xyz.h': No such file or directory? 严重错误C1083:在发布模式下无法打开包含文件:“ mysql_connection.h” - fatal error C1083: Cannot open include file: 'mysql_connection.h' in release mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM