SFS2X_API_Cpp_v1.6.3 compiling woes

Post here your questions about the C++ API for SFS2X

Moderators: Lapo, Bax, MBagnati

Rmuhr
Posts: 3
Joined: 27 Jan 2016, 03:59

SFS2X_API_Cpp_v1.6.3 compiling woes

Postby Rmuhr » 27 Jan 2016, 14:04

Hi all.
We are planning to use SFS with our UE4 engine and were very excited to see that you updated your api to be compatible with VS2015.
I have followed the api compiling directions located at http://docs2x.smartfoxserver.com/Gettin ... nt-api-cpp

I downloaded the api, extracted the zip.
Ran the b2 commands replacing msvc-10.0 with msvc-14.0
All ran fine and created the 10 lib files.

Then I opened the solution from the vs2015 folder.
Your next step calls for rebuild for both debug and release. At this point I had to switch the platform from Itanium to X64

I had to add the [apifolder]\Core\BoostAsio\Windows to include of the project to even start the compile (isn't very clear from the directions to do this before building)
Now we went to build......
after some waiting, things started screaming about not being able to open the openssl/insertrandomfilefromthedirectory.h

the first instance of this error occurs with opens_types.hpp
Tried adding the folder containing openssl folder to additional header path and/or additional include path
Ultimately none of it seemed to work until I placed a copy of the openssl folder contents from
[api_folder]\Core\openssl\Win\include
to
[api_folder[]\openssl\

Then the dozens of reference errors went away... yay.
Onto the next error now....
[api_folder]\Util\CryptoInitializer.cpp
Error C2039 'future': is not a member of 'boost' SmartFoxClientApi [api_folder]\util\cryptoinitializer.cpp 72


at this point I am 3 days into trying to compile this thing and thought to myself, surely it can not be this complicated and I am making an idiot mistake somewhere.

Any guidance would be greatly appreciated!

Thanks
User avatar
Lapo
Site Admin
Posts: 20276
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X_API_Cpp_v1.6.3 compiling woes

Postby Lapo » 27 Jan 2016, 14:17

Hi,
I've passed your request to our C++ expert. Stay tuned :)
Lapo
--
gotoAndPlay()
...addicted to flash games
MBagnati
Posts: 125
Joined: 12 Feb 2013, 10:57

Re: SFS2X_API_Cpp_v1.6.3 compiling woes

Postby MBagnati » 28 Jan 2016, 06:26

Hi,

I suspect that issue is about the settings of Visual Studio project.
You say
I had to switch the platform from Itanium to X64

please set X64 project's settings using the other one as guideline.

In particular:

  • Right click on SmartFoxClientApi project in Solution Explorer and choose "Properties"
    From C/C++ tree node select "Preprocessor"
    Check that "Preprocessor Definitions" contains

    _CRT_SECURE_NO_WARNINGS
    ZLIB_WINAPI
    BOOST_THREAD_PROVIDES_FUTURE

    I think that you have not BOOST_THREAD_PROVIDES_FUTURE and this can be the cause of compiler error
  • From C/C++ tree node select "General"
    Check that "Additional Include Directories" contains

    $(ProjectDir)../../Core/BoostAsio/Windows/
    $(ProjectDir)../../Core/OpenSSL/Win/include
  • From Linker tree node select "General"
    Check that "Additional Library Directories" contains

    $(ProjectDir)../../Core/BoostAsio/Windows/stage/lib
    $(ProjectDir)../../Core/OpenSSL/Win/lib/Win64/VS2015
    $(ProjectDir)../../ZLib/contrib/vstudio/vc14/x86/ZlibDllRelease
  • From Linker tree node select "Input"
    Check that "Additional Dependencies" contains

    legacy_stdio_definitions.lib
    zlibwapi.lib
    libeay32.lib (I reserve to check if right name is libeay32 or libeay64 for X64 environment)
    ssleay32.lib (I reserve to check if right name is ssleay32 or ssleay64 for X64 environment)
Rmuhr
Posts: 3
Joined: 27 Jan 2016, 03:59

Re: SFS2X_API_Cpp_v1.6.3 compiling woes

Postby Rmuhr » 31 Jan 2016, 02:32

Sorry about the delay, had some other things I was working on.

Ok, I reloaded the project to make sure that I didn't screw things up.
Adding the additional libraries as posted has resolved dependencies.
The preprocessor had nothing in it.
Added as described.


Severity Code Description Project File Line Suppression State
Error C2039 'future': is not a member of 'boost' SmartFoxClientApi g:\sfs2x_api_cpp_v1.6.3\util\cryptoinitializer.cpp 72
Any more suggestions?
MBagnati
Posts: 125
Joined: 12 Feb 2013, 10:57

Re: SFS2X_API_Cpp_v1.6.3 compiling woes

Postby MBagnati » 02 Feb 2016, 00:54

Hi,
To investigate the issue, I have done these steps that I think are very similar to your actions.
Please follow this guideline to check what you have done and discover differences.
I suppose the absence of "future" file that you see, simply depends on missed or bad setting of an environment option.

1) Download the API and extract the zip in G:\SFS2X_API_Cpp_v1.6.3 (like you)
2) Run the b2 commands from "G:\SFS2X_API_Cpp_v1.6.3\Core\BoostAsio\Windows" replacing msvc-10.0 with msvc-14.0 and adding address-model=64 (because you need to build API for X64 platform)

b2 -a toolset=msvc-14.0 threading=multi link=static runtime-link=shared address-model=64 --with-system stage
b2 -a toolset=msvc-14.0 threading=multi link=static runtime-link=shared address-model=64 --with-date_time stage
b2 -a toolset=msvc-14.0 threading=multi link=static runtime-link=shared address-model=64 --with-chrono stage
b2 -a toolset=msvc-14.0 threading=multi link=static runtime-link=shared address-model=64 --with-regex stage
b2 -a toolset=msvc-14.0 threading=multi link=static runtime-link=shared address-model=64 --with-thread stage

At this point, I have checked that all ran fine and that have been created the 10 libraries in G:\SFS2X_API_Cpp_v1.6.3\Core\BoostAsio\Windows\stage\lib

3) Open the solution from G:\SFS2X_API_Cpp_v1.6.3\SmartFoxClientApi\VS2015 folder
and switch the platform from Itanium to X64

4) Right click on SmartFoxClientApi project in Solution Explorer and choose "Properties"
From C/C++ tree node select "Preprocessor"

Set "Preprocessor Definitions" for Release configuration on X64 platform with these values

NDEBUG
_WINDOWS
_USRDLL
SMARTFOXCLIENTAPI_EXPORTS
_CRT_SECURE_NO_WARNINGS
ZLIB_WINAPI
BOOST_THREAD_PROVIDES_FUTURE
_WIN32_WINNT=0x0501
WIN32_LEAN_AND_MEAN

Set "Preprocessor Definitions" for Debug configuration on X64 platform with these values

_DEBUG
_WINDOWS
_USRDLL
SMARTFOXCLIENTAPI_EXPORTS
_CRT_SECURE_NO_WARNINGS
ZLIB_WINAPI
BOOST_THREAD_PROVIDES_FUTURE
_WIN32_WINNT=0x0501
WIN32_LEAN_AND_MEAN

5) From C/C++ tree node select "General"
and than "Additional Include Directories"


Set these paths for both Debug and Release configuraions on X64 platform

$(ProjectDir)../../Core/BoostAsio/Windows/
$(ProjectDir)../../Core/OpenSSL/Win/include


6) From Linker tree node select "General"
and than "Additional Library Directories"

Set these values for Debug configuraion on X64 platform

$(ProjectDir)../../Core/BoostAsio/Windows/stage/lib
$(ProjectDir)../../Core/OpenSSL/Win/lib/Win64/VS2015
$(ProjectDir)../../ZLib/contrib/vstudio/vc14/x64/ZlibDllDebug

Set these values for Release configuraion on X64 platform

$(ProjectDir)../../Core/BoostAsio/Windows/stage/lib
$(ProjectDir)../../Core/OpenSSL/Win/lib/Win64/VS2015
$(ProjectDir)../../ZLib/contrib/vstudio/vc14/x64/ZlibDllRelease

7) From Linker tree node select "Input"
and than "Additional Dependencies"

Set these values for both Debug and Release configuraions on X64 platform

legacy_stdio_definitions.lib
zlibwapi.lib
libeay32.lib
ssleay32.lib

8 ) Right click on zlibvc project in Solution Explorer and choose "Build Events" and than "Pre-Build Events"
For both Debug and Release configurations on X64 platform change "Command line" in

cd G:\SFS2X_API_Cpp_v1.6.3\ZLib\contrib\masmx64
bld_ml64.bat

9) Rebuild whole Visual Studio solution for Debug and/or Release configuration on X64 platform
It should be done without errors
Rmuhr
Posts: 3
Joined: 27 Jan 2016, 03:59

Re: SFS2X_API_Cpp_v1.6.3 compiling woes

Postby Rmuhr » 05 Feb 2016, 02:07

Following these directions to the T has resulted in successful build in both debug and release!
Thank you!
imperator132k
Posts: 6
Joined: 05 Jan 2016, 16:18

Re: SFS2X_API_Cpp_v1.6.3 compiling woes

Postby imperator132k » 13 Oct 2016, 16:12

This is a brilliant post. These instructions should be put on the support page. Worked perfectly.

Return to “SFS2X C++ API”

Who is online

Users browsing this forum: No registered users and 1 guest