2

I am working in Qt 5.2, and have a class which needs to use boost::asio's sockets. My header for this class is formatted like this:

#include <boost/asio.hpp>
#include <iostream>
#include <list>
#include <QFile>
#include <string>
#include <utility>
#include <vector>
#ifndef MyClass_H
#define MyClass_H

class MyClass
{
public:
    MyClass();

private:
    boost::asio::io_service io;
    boost::asio::ip::tcp::socket socket;
};

#endif // MyClass_H

This class works fine...on its own. However, I need to call this object in another class. When I try to add #include "MyClass.h" to the other file, I get three identical error messages which read

C1189: #error: WinSock.h has already been included

I don't have this file explicitly included anywhere in my project, and I do reinclude any of the boost libraries in the class to which MyClass is being included. I've found a lot of similar issues in forums online, but it seems like the solution is always to make the include line for boost/asio the first include in the file, and I already have it that way and am still getting errors. If anyone can please help I'd really appreciate it, thanks.

thnkwthprtls
  • 3,287
  • 11
  • 42
  • 63

0 Answers0