Using Steamworks in Unreal Engine 4 - c++

So I've started implementing Steamworks functions for my game, and everything went perfectly fine. I managed to get sync with steam API ( i can do achievements and see that i'm playing game on my steam acc). However when i wanted to start using some functions that they provided, my engine is saying:
error LNK2019: unresolved external symbol
Anyone can help me solve this problem? I'm aiming atm at reading and saving score in Leaderboards. Any good advices for me ? :D
Code sample that gives me error:
int MyCodeLibrary::TryGetScore()
{
if (SteamAPI_Init())
{
CSteamLeaderboards obj();
obj().FindLeaderboard("test");
obj().DownloadScores();
return 0;
}
else
{
return 0;
}
}
Also tried to get to Steam with OnlineSubsystem like this:
void MyCodeLibrary::UpdateScoreInt(int score, FName board, APlayerController* PlayerController)
{
OutputDebugStringA("Funkcja jest wywoływana");
if (SteamAPI_Init())
{
OutputDebugStringA("Steam API działa");
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PlayerController->Player);
IOnlineSubsystem* ion = IOnlineSubsystem::Get(FName("Steam"));
TSharedPtr<const FUniqueNetId> UserId = ion->GetIdentityInterface()->GetUniquePlayerId(LocalPlayer->GetControllerId());
ion->GetLeaderboardsInterface();
FOnlineLeaderboardWrite wrt;
wrt.LeaderboardNames.Add(board);
wrt.SetIntStat(TEXT("Score"), score);
if (UserId.IsValid())
{
OutputDebugStringA("Mam UserID");
ion->GetLeaderboardsInterface()->WriteLeaderboards(board, *UserId, wrt);
printf("Odpalony score");
}
}
}

So, I've included library "steam_api64.lib" in my source, but after that i've recieved lots of error which suggest that everyting in steam_api.h is wrong :/
I'm pretty new to it, so would appreciate some furthere help with it. Here are examples of errors showing:
error C2371: "S_CALLTYPE": redefinition; different basic types
error C4430: missing type specifier-int assumed. Note C++ does not support default-int
Did I included anything wrong or missing something? Steam_api.h file is downloaded directly from steamworks and has not been modified.

Related

destructor not recognised by Xcode

new to this forum and to programming so please forgive any potential mistakes in my question. I am trying to code a game in c++ using SDL2 and Xcode 6.3.2. In my Game class (see below) Xcode does not recognise my destructor and gives me the error: expected member name or ';' after declaration
I have no idea what is wrong with my destructor or my code in general. My question is simply: What have I done wrong? Thanks in advance!
update:
Narrowed the issue down and ran the code in cpp.sh without any issues. Xcode still gives the error message and I am unable to build because of it. I have tried restarting my computer, deleting the derived data and cleaning the build folder but to no effect.
int main() {
class Game {
public:
Game();
~Game(); //here is the issue
};
}
update 2: Simply removed the non working code and retyped it. The error message did not reappear and the build succeeded. Xcode had probably indeed cached the error message in some strange way.
You need to have written:
Game::~Game(){
}
somewhere at the bottom, outside the class.
Then it will compile fine :)

Error C3083 '`global namespace'': the symbol to the left of a '::' must be a type cpprestsdk

I'm using cpprestsdk for a Http client in my code as given below:
std::string MyClass::GetPage(std::string url)
{
web::http::client::http_client httpClient(utility::conversions::to_string_t(url));
pplx::task<web::http::http_response> request = httpClient.request(web::http::methods::GET);
request.then([=](pplx::task<web::http::http_response> task)
{
// TODO: handle exceptions here.
web::http::http_response response = task.get();
return response.extract_string();
});
}
I'm getting this strange set of compiler errors stated in the question header for multiple files. One example reference the error is point to is in http_client.h:
const utf16string &content_type = ::utility::conversions::to_utf16string("text/plain"),
in which there's nothing before the ::utility. This happens in multiple places and it's not my code. This is straight from SDK. I downloaded the API using NuGet package manager. Help please. Thanks.

Problems porting lexer string accumulator to new version of Quex

While porting my lexer file from Quex 0.64.8 to 0.67.4 I ran
into some problems with the string accumulator. The issues
I get look like this:
Severity Code Description Project File Line Suppression State
Error C3861 'ecmascript_lexer_Accumulator__clear': identifier not found (compiling source file C:\Users\Patrikj\Work\git\ecmascript_build_vc14_x64\generated\ecmascript_lexer.cpp) ktes C:\Users\Patrikj\Work\git\ecmascript\ecmascript.qx 107
I suppose it's the double underline Accumulator__clear that is the cause of the issue. Maybe I need to supply a new switch to Quex or maybe the API
has changed in the newer version. Either way I am at a loss on how to
fix the issue.
And example from my lexer (.qx) that generates the issue:
mode StringHelper : EOF
<inheritable: only>
{
on_exit {
/// All 3 rows using the accumulator generates an error similiar to the one mentioned above
if(self.accumulator.text.begin != self.accumulator.text.end)
self_send(TOK_STRLITPART);
self_accumulator_flush(TOK_QUOTE);
self_accumulator_clear();
}
}
Any help fixing this issue would be much appreciated.
Best regards,
Patrik J
Version 0.67.3 and later excluded the string accumulator from
the main generator. The reason was that for some situations
there is no general solution in the construct, include-push,
and reset scenarios. Users must specify them as they go along.
For using the accumulator, no command line option is required.
However, in the .qx files the following sections need to be defined
(this is an example):
header {
#include <quex/code_base/extra/accumulator/Accumulator>
}
footer {
#include <quex/code_base/extra/accumulator/Accumulator.i>
}
body {
QUEX_NAME(Accumulator) accumulator;
}
constructor {
if( ! QUEX_NAME(Accumulator_construct)(&me->accumulator, me) ) {
return false;
}
}
destructor {
QUEX_NAME(Accumulator_destruct)(&me->accumulator);
}
print {
QUEX_NAME(Accumulator_print_this)(&me->accumulator);
}
The case with the PostCategorizer is the same. You find the setup
shown below in 'common.qx' files in the demo subdirectories.
Also, after 'flush()' you do not need to 'clear()'.

Add a header to a cppnet-lib response object

I would like to add a header to a cppnet-lib basic_response object. However, I am getting compilation errors.
I can add a header to a basic_request as follows which compiles ok:
boost::network::http::basic_request<boost::network::http::tags::http_server> request;
request << header("test", "test");
However, doing the same for a response object as follows receives a compilation error:
boost::network::http::basic_response<boost::network::http::tags::http_server> response;
response << header("test", "test");
Compilation error:
'headers_container_type': the symbol to the left of a '::' must be a type (header.hpp)
'value_type': is not a member of boost::network::http::basic_response<boost::network::http::tags::http_server> (header.hpp)
syntax error: missing ';' before identifier 'value_type' (header.hpp)
This would suggest that this isn't possible on a response object, but following the following page seems to suggest it is. I'm obviously going wrong somewhere!
Documentation: http://cpp-netlib.org/0.8/reference_http_response.html
My environment is:
Visual Studio 2013 (building as Release)
Boost 1.55
cppnet-lib: 0.11.0
Any help would be very much appreciated! Thanks.
First, I think you're using the wrong documentation since you're using version 0.11.0 (I suggest you use 0.11.1, which has a lot of bug fixes on top of 0.11.0). Here's the link you actually want for the 0.11.0 documentation:
http://cpp-netlib.org/0.11.0/reference/http_server.html#response-object
Second, you'd want to add headers directly to the response object's headers member. No need to use functions to do this:
struct my_server {
void operator(server::request const& req, server::response & res) {
// do something with the request and/or response
res.headers.push_back(server::response::header("Name", "value"));
// do more things
}
// ...
};

Embedding Lua to C++ and wxWidgets using Eclipse IDE

I am new to Lua so I am sorry if this is rather an easy question but it is driving me nuts. In my previous thread A simple query on calling Lua 5.2 from C++ I have used an easy C++ code to embed Lua in it. Things worked well but when I transfer that concept to a more complex project, the same code does not work. I have checked many sources but could not find a solution.
Here is my code:
#include "External/include/lua.hpp"
lua_State *luastate =NULL;
IMPLEMENT_APP(ScienceSuitApp);
bool ScienceSuitApp::OnInit()
{
luastate=luaL_newstate();
luaL_openlibs(luastate);
ScienceSuitFrame* frame = new ScienceSuitFrame(0L);
frame->Show();
return true;
}
Now when I try to compile the code, I am getting invalid arguments error for the luaL_openlibs(luastate) line. The error that the compiler gives:
Invalid arguments '
Candidates are:
void luaL_openlibs(*)
' ScienceSuitApp.cpp /ScienceLab line 33 Semantic Error
This is actually happening whenever I call a Lua function such as luaL_dostring etc.. which takes lua_State as parameter. By the way, I am using Eclipse as IDE and wxWidgets as GUI if that should give a clue. Any my configuration for this set up is:
I "think" I have solved the problem. It stems from the fact that Eclipse throws a "semantic error" and not a "syntax error". Therefore, I followed the advice from Eclipse CDT shows semantic errors, but compilation is ok. But now my question is what does it have to do with Indexing in Eclipse IDT? It feels like I am using Eclipse without knowing any of its internals.