Code Monkey home page Code Monkey logo

Comments (8)

fweidner avatar fweidner commented on June 12, 2024 1

Hi,

afaik, the C4647 error should be gone if you do step 2 in the guide (comment out "static_assert(std::is_pod::value, "");".
I ignored the 4800 error with the by ignoring it with a pragma (see step 7).
Be aware that you have to add the "pragma warning (disable ...)" in each of your pb.h file.

Currently, we are facing more problems. For more info see: protocolbuffers/protobuf#4129

Best,
Florian

from libprotobuf_ue4.

fweidner avatar fweidner commented on June 12, 2024

Same here. Have you found a solution for this issue, @NelsonBilber ?

from libprotobuf_ue4.

NelsonBilber avatar NelsonBilber commented on June 12, 2024

Not really ... the only version that I can make work was 3.2.0.

After generate visual studio solution I need to change the projects settings on C++ -> code generation to Multi-threaded DLL (/MD)

Then when generate files with protoc on filles *.pb.cc
I also have to disable some warning in order to compile project

Example:
Add these pragmas on protobuff generated files " *.pb.cc " on the top of file

//...
pragma warning(push)
#pragma warning(disable : 4668) // warning C4668: A symbol that was not defined was used with a preprocessor directive. The symbol will evaluate to false
//...

Don't forget on unreal project source code to include theses
#include "AllowWindowsPlatformTypes.h"
//...
#iinclude "...*.pb.cc "
//..
#include "HideWindowsPlatformTypes.h"

I'm not complete confident that is robust lets see during development if it's a stable solution

Regards

from libprotobuf_ue4.

fweidner avatar fweidner commented on June 12, 2024

Was able to compile it successfully. Here are my steps:
https://medium.com/@0xflarion/using-ue4-w-google-protocol-buffers-ae7cab820d84

from libprotobuf_ue4.

aaronsnoswell avatar aaronsnoswell commented on June 12, 2024

@fweidner Any chance of a pull request (thanks for the blog post by the way!)

from libprotobuf_ue4.

fweidner avatar fweidner commented on June 12, 2024

@aaronsnoswell i did not base my code on this repo (yet). I'll try to reproduce it next week and will create a pull request.

from libprotobuf_ue4.

kelteseth avatar kelteseth commented on June 12, 2024

@fweidner any update on this? I tried to compile this project with protobuf 3.5 but I get several error messages:

  1. Complie Protobuf 3.5 via your guide
  2. Copy and replace the lib files into the plugin folder
  3. Update the Protobuf submodule to 3.5
  4. Changed to libprotobuf.Build.cs to:
// Copyright 2016 Code 4 Game. All Rights Reserved.
using System.IO;
using System;

using UnrealBuildTool;

public class libprotobuf : ModuleRules
{
    public libprotobuf(TargetInfo Target)
    {
        Type = ModuleType.External;

        bool is_supported = false;
        if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
        {
            is_supported = true;

            string vs_path = "vs"
                + WindowsPlatform.GetVisualStudioCompilerVersionName()
                + ((Target.Platform == UnrealTargetPlatform.Win64) ? "win64" : "");
            string protobuf_lib_directory_full_path = System.IO.Path.Combine(ModuleDirectoryFullPath, "lib", vs_path);

            PublicLibraryPaths.Add(protobuf_lib_directory_full_path);

            PublicAdditionalLibraries.Add("libprotobuf.lib");

            Definitions.AddRange(
                new string[]
                {
                    ((Target.Platform == UnrealTargetPlatform.Win64) ? "WIN64" : "WIN32"),
                    "_WINDOWS",
                    "NDEBUG",
                    "GOOGLE_PROTOBUF_CMAKE_BUILD",
                });
        }

        if (is_supported)
        {
            string protobuf_code_directory_full_path = System.IO.Path.Combine(ModuleDirectoryFullPath, "protobuf", "src");

            PublicSystemIncludePaths.Add(protobuf_code_directory_full_path);
        }
        LoadGoogleProtocolBuffers(Target);
    }

    string ModuleDirectoryFullPath
    {
        get { return System.IO.Path.GetFullPath(ModuleDirectory); }
    }

    public bool LoadGoogleProtocolBuffers(TargetInfo Target)
    {
    bool isLibrarySupported = false;

    if ((Target.Platform == UnrealTargetPlatform.Win64)){
        isLibrarySupported = true;

        string LibrariesPath = Path.Combine(ThirdPartyPath, "libprotobuf", "lib");

        Console.WriteLine("... LibrariesPath -> " + LibrariesPath);
        PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libprotobufd" + ".lib"));
    }

    if (isLibrarySupported){
        string IncludePath= Path.Combine(ThirdPartyPath, "libprotobuf", "include");

        Console.WriteLine("... IncludePath -> " + IncludePath);
        PrivateIncludePaths.Add(IncludePath); }

        Definitions.Add(string.Format("WITH_GPB_BINDING={0}", isLibrarySupported ? 1 : 0));

        return isLibrarySupported;
    }
    private string ModulePath
    {
        get { return ModuleDirectory; }
    }
    private string ThirdPartyPath
    {
        get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
    }

}

//Error messages when compiling my game

Schweregrad	Code	Beschreibung	Projekt	Datei	Zeile	Unterdrückungszustand
Fehler	C4800	"google::protobuf::internal::Atomic64": Variable wird auf booleschen Wert ("True" oder "False") gesetzt (Auswirkungen auf Leistungsverhalten möglich)	Community	C:\Users\Eli\Code\Unreal\Community\Source\ThirdParty\libprotobuf\protobuf\src\google\protobuf\io\coded_stream.h	857

Schweregrad	Code	Beschreibung	Projekt	Datei	Zeile	Unterdrückungszustand
Fehler	C4647	Verhaltensänderung: __is_pod(google::protobuf::internal::AuxillaryParseTableField) hat in früheren Versionen einen anderen Wert.	Community	C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits	414	

Schweregrad	Code	Beschreibung	Projekt	Datei	Zeile	Unterdrückungszustand
Fehler	C4541	"dynamic_cast" für polymorphen Typ "google::protobuf::Message" mit /GR- verwendet; unvorhersehbares Verhalten möglich	Community	C:\Users\Eli\UE4\UE_4.18\Engine\Source\Runtime\CoreUObject\Public\Templates\Casts.h	390	```

from libprotobuf_ue4.

avdept avatar avdept commented on June 12, 2024

I was able to build and run latest 3.12.0 protobuf and it looks to be running just fine. I've unchecked MSVC_STATIC_RUNTIME, built and copied includes and lib file into according folders. Let me know if you get some questions. Also when going more complicated protocols - you need to suppress some warnings, otherwise it wont compile

from libprotobuf_ue4.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.