Hey Guys,
This may not be the most appropriate place to ask this question as it relates more to C++ than Arduino, but I thought someone else may have already solved this problem.
I've just used the SerialClass posted in the Arduino Playground (Arduino Playground - CPPWindows) to interface the serial output of an Arduino with a C++ console application via Microsoft Visual Studio. That works great and I can see the data from the attached sensor in the console.
I'm now trying to integrate that functionality with windows TCP/IP sockets, so that I can broadcast the sensor data to a server program. I've been using code to do that which uses the following headers to enable the socket functionality.
#include <Afxwin.h>
#include <winsock2.h>
The problem is that including these headers messes up the SerialClass, as it #includes windows.h. I get the following error:
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>.
If I remove windows.h then I get a 81 errors just from the SerialClass (as expected), such as missing ';'s, when they clearly exist.
I tried moving the use of MFC to standard windows libraries and including #define _AFXDLL as prompted but that gives me the same error as above.
So the Arduino SerialClass needs windows.h, and sockets need winsock2.h, which can't be used in conjuction with windows.h
Any ideas how to get around this? Any help appreciated. As you can tell, I'm not too hot on C++!
Thanks,
Ad