2

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) I have created project in Visual Studio 2010 as shown in snapshots below:

pic1

pic2

pic3

2) I have edited the code to include a small hello world code just to check if it compiles.

pic4

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.

pic5

pic6

4) When I try to compile, it gives me following error:

pic7

My doubts are as follows:

1) Have I included libmodbus correctly in my project? Or is there a better or correct way to do the same?

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?

Thank you.

Jay
  • 1,210
  • 9
  • 28
  • 48
  • 1
    There is a file called "config.h.in" in the libmodbus folder. How is it linked to above error that I am not able to figure out. – Jay Apr 12 '13 at 17:04
  • 3
    Is libmodbus a library mostly intended to be built using gnu autoconf? A file named "config.h.in" is usually an input to the GCC+GNU-Autoconf tools commonly. If you want to build this on Visual C++ there is probably a README that comes with this source package distribute. Did you read it? Maybe even win32 users have to install Cygwin or Mingw to do an autoconf/configure stage before you can build on Win32? Building on Linux would start with running `./configure` and config.h would be a result of that initial config task. – Warren P Apr 12 '13 at 23:21
  • @WarrenP Thank you for the reply. I am looking into the ways to do it. Shall be solved soon. Thanks again. – Jay Apr 13 '13 at 11:22

1 Answers1

2

Latest version of libmodbus provides Visual Studio project files.

https://github.com/stephane/libmodbus/tree/master/src/win32

stephane
  • 31
  • 4