MFC中的libmodbus [英] libmodbus in MFC
问题描述
我正在尝试将libmodbus提供的modbus库集成到Visual Studio 2010中的自定义MFC项目中.
I am trying to integrate modbus library given by libmodbus into a custom MFC project in Visual Studio 2010.
到目前为止,我所遵循的步骤如下:
The steps that I have followed till now are as follows:
1)我已经在Visual Studio 2010中创建了项目,如下面的快照所示:
1) I have created project in Visual Studio 2010 as shown in snapshots below:
2)我已经对代码进行了编辑,以包含一个小的hello world代码,只是为了检查其是否可以编译.
2) I have edited the code to include a small hello world code just to check if it compiles.
3)我已将.c和.h文件从libmodbus-3.0.3的src文件夹复制到Visual Studio项目文件夹,如下所示,并将它们包括在项目中.
3) I have copied .c and .h files from src folder of libmodbus-3.0.3 to Visual Studio project folder as shown below and included them in the project.
4)尝试编译时,出现以下错误:
4) When I try to compile, it gives me following error:
我的疑问如下:
1)我是否在项目中正确包含了libmodbus?还是有更好或正确的方法来做到这一点?
1) Have I included libmodbus correctly in my project? Or is there a better or correct way to do the same?
2)如何消除即将出现的错误:无法打开包含文件"config.h".没有这样的文件或目录.
我已经看到,我从 http://下载的libmodbus-3.0.3中没有config.h文件. libmodbus.org/download/
如何继续前进?
2) How to eliminate the error that is coming: Cannot open include file: 'config.h'. No such file or directory.
I have seen that there is no config.h file in the libmodbus-3.0.3 that I have downloaded from http://libmodbus.org/download/
How to proceed ahead?
谢谢.
推荐答案
最新版本的libmodbus提供了Visual Studio项目文件.
Latest version of libmodbus provides Visual Studio project files.
https://github.com/stephane/libmodbus/tree/master/src/win32
这篇关于MFC中的libmodbus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!