← Back to team overview

modbus team mailing list archive

[Modbus Question]How to run libmodbus-3.0.1 on windows 2003 server

 

Hi all,
I wanna know how i can run our libmodbus-3.0.1 on windows 2003 server.
I find the document
tells us 'If you want to compile with Microsoft Visual Studio, you
need to install
http://code.google.com/p/msinttypes/ to fill the absence of stdint.h.'
 I just download
the msinttypes and put its two head files into llibmodbus-3.0.1/src/.

Following is my code.

/*
 * Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@xxxxxxxxx>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 *
 * This library implements the Modbus protocol.
 * http://libmodbus.org/
 */
#include <stdio.h>
#include <stdlib.h>
#include "modbus.h"
#include "modbus-private.h"

int main(int argc, char **argv)
{
	modbus_t *ctx;

	ctx = modbus_new_tcp("127.0.0.1", 502);
	if (modbus_connect(ctx) == -1) {
		fprintf(stderr, "Connection failed\n");
		modbus_free(ctx);
		return -1;
	}
	return 0;
}

It can not be compiled well. Can anyone tell me the details about how to
compile the libmodbus-3.0.1 under visual-studio-6.0 on windows.

Thanks in advance.
Harry Wei.