Including PhotonPeer.h (c++) gives over 140 errors (VS2013)

Serphimera
edited May 2015 in Native
Hello community,

I'm having issues to figure out what gives me so many errors in VS13. My setup is as follows:

IDE: VS2013 Community
Language: C++
Project: Windows console application with prevompiled headers

C++ Includes: D:\Programmierung\Photon\Photon-Windows-Sdk_v4-0-2-2
Linker Lib Dirs: - D:\Programmierung\Photon\Photon-Windows-Sdk_v4-0-2-2\Common-cpp\lib
- D:\Programmierung\Photon\Photon-Windows-Sdk_v4-0-2-2\Photon-cpp\lib
Linker Depends: Common-cpp_release_windows_md_Win32.lib;Photon-cpp_release_windows_md_Win32.lib;%(AdditionalDependencies)

I then try the following setup:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

// TODO: reference additional headers your program requires here
#include <Windows.h>
#include "Photon-cpp/inc/PhotonPeer.h"
#include "Photon-cpp/inc/PhotonListener.h"

using namespace ExitGames::Photon;

and in my cpp-file:
// PhotonClient.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	return 0;
}

Nothing more - nothing less. When i hit run (release mode) the ide throws 142 errors and i can't get the point why this happens. Perhaps anyone can help me here.

Comments

  • Hi Serphimera.

    Please change
    [code2=cpp]#include <Windows.h>
    #include "Photon-cpp/inc/PhotonPeer.h"[/code2]
    into
    [code2=cpp]#include "Photon-cpp/inc/PhotonPeer.h"
    #include <Windows.h>[/code2]

    Windows.h includes winsock.h (Windows sockets 1.1), while Photon includes winsock2.h (Windows sockets 2.2). The newer winsock2.h is aware of the existence of the older and conflicting winsock.h, but winsock.h is not aware of the existence of winsock2.h, so when winsock2.h gets included first, then it will prevent the inclusion of winsock.h by defining _WINSOCKAPI_, but unfortunately it doesn't work the other way round.

    For further information please have a look at http://doc-api.exitgames.com/en/onpremi ... ng_Windows



    The line
    [code2=cpp]#include "Photon-cpp/inc/PhotonListener.h"[/code2]
    can be removed entirely. PhotonPeer.h already includes all headers from Common-cpp and from Photon-cpp that are intended for public use.
  • Hi Kaiserludi,

    thanks for clearing things up. I wasn't aware of that fact and unfortunately didn't read the troubleshooting guide.

    Greetings

    Serphimera