Make your own free website on

Installing C++ source files

When extracting the source files keep the directory structure for correct compilation.

Load the workspace Modbucfg.dsw, this workspace contain 3 projects , Modbucfg (Modbus configuration utility) , Modbulib (A library containing the modbus classes and some other classes) and ModbusServer (ActiveX server ).

Before trying to compile you need to change some options of Visual C++ :

Suppose you extract the file to a directory called c:\Modbus then

a) Add the directory "C:\Modbus\UtilClasses\include" to Tool | directory | Include Files

b) Add the directory "C:\Modbus\ModbuLib" to Tool | directory | Library Files

Now you can build the projects. Try first the debug version following the steps below:

  1. First set active project as Modbulib - Win32 Debug and build this project.
  2. Build the project ModbusServer - Win32 Debug.
  3. Now you can build the project ModbuCfg - Win32 Debug and test the project.

When you desire to add the Modbus classes to your MFC project is necessary add a line

#include "mbu.h"

to stdafx.h file. This header file include some MFC and ATL header files used by modbus classes.

and add the line

#include <atlimpl.cpp>

to stdafx.cpp. This is needed to use some ATL classes.

Include the header files of the class you are interested, for instance LocalModbus.h,   and use MFC as shared DLL.

These includes add MFC and ATL classes to your project.

CModbus class, Home