andrivet / ADVobfuscator

Obfuscation library based on C++11/14 and metaprogramming
1.39k stars 238 forks source link

build error with CMake #32

Closed mhmdrz-mirdamadi closed 2 years ago

mhmdrz-mirdamadi commented 2 years ago

I have been working on a project and first I built it with visual studio solutions and it worked perfectly. However, when trying to build the same project with CMake an error occurs that I cannot understand why it happens!

Here is the error message

C2440   'reinterpret_cast': cannot convert from 'F' to 'andrivet::ADVobfuscator::ObfuscatedAddress<std::string>::func_ptr_integral' 
my_project_directory\out\build\x64-Debug\quantumsample
C:\Users\Bpc\myProjects\vcpkg-master\installed\x64-windows-mixed\include\Lib\MetaFSM.h  162 

And here is the block code of this part

template<typename F>
    struct ObfuscatedAddress
    {
        // Pointer to a function
        using func_ptr_t = void(*)();
        // Integral type big enough (and not too big) to store a function pointer
        using func_ptr_integral = std::conditional<sizeof(func_ptr_t) <= sizeof(long), long, long long>::type;

        func_ptr_integral f_;
        int offset_;

        constexpr ObfuscatedAddress(F f, int offset): f_{reinterpret_cast<func_ptr_integral>(f) + offset}, offset_{offset} {}
        constexpr F original() const { return reinterpret_cast<F>(f_ - offset_); }
    };
andrivet commented 2 years ago

Since you said it is working in Visual Studio, it is probably a mistake in your setup or code. Sorry, but I do not provide support on this project.