I want to create a method in c++ which returns a SOCKET Object, using WinSock2.
//header
#pragma once
class MyClass
{
public:
SOCKET createSocket();
};
//definitions
#include "class.h"
#include <WinSock2.h>
SOCKET MyClass::createSocket()
{
return SOCKET();
}
Yet, Visual Studio throws an error (E0147, C++ Die Deklaration ist nicht mit " (deklariert in Zeile 7 von)" kompatibel.)
How can I fix this?
#include <WinSock2.h>
is missing in the header. (Thanks Johnny Mopp)