billyquith / ponder

C++ reflection library with Lua binding, and JSON and XML serialisation.
http://billyquith.github.io/ponder/
Other
645 stars 95 forks source link

How to build and user ponder with windows7? #127

Open acyyhaa opened 2 years ago

acyyhaa commented 2 years ago

I want to build ponder for visual studio 2019

billyquith commented 2 years ago

What is stopping you from doing that?

thegoodtgg commented 2 years ago

I also failed to build ponder-v3.0.0 on visual studio 2019. Then I tried to build it on visual studio 2015 and it also failed. The error happened while building the "args.cpp". I think it failed on forward declaration for "ponder::Value". Then I digged into source then find that "ponder::Value" dependent on "ponder::UserObject", "ponder::UserObject" dependent on "ponder::Args" and "ponder::Value", "ponder::Args" dependent on "Ponder::Value". So @billyquith used forward declaration in the "args.hpp" for "ponder::Value". However, I don't understand how std::vector instantiate while missing "ponder::Value" definition.

1>args.cpp 1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vector(1279): error C2036: 'const ponder::Value ': unknown size 1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vector(1276): note: while compiling class template member function 'void std::vector<ponder::Value,std::allocator<_Ty>>::push_back(const ponder::Value &)' 1> with 1> [ 1> _Ty=ponder::Value 1> ] 1>D:\third-party\C++\common\reflection\ponder-3.0.0\src\args.cpp(63): note: see reference to function template instantiation 'void std::vector<ponder::Value,std::allocator<_Ty>>::push_back(const ponder::Value &)' being compiled 1> with 1> [ 1> _Ty=ponder::Value 1> ] 1>D:\third-party\C++\common\reflection\ponder-3.0.0\include\ponder/args.hpp(143): note: see reference to class template instantiation 'std::vector<ponder::Value,std::allocator<_Ty>>' being compiled 1> with 1> [ 1> _Ty=ponder::Value 1> ] 1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vector(1285): error C2036: 'ponder::Value ': unknown size 1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vector(1294): error C2036: 'ponder::Value ': unknown size 1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vector(1296): error C2036: 'ponder::Value ': unknown size

thegoodtgg commented 2 years ago

I try the code below. It do failed.

` // Foo.h

pragma once

struct Foo { int v_; }

// FooList.h

pragma once

include

struct Foo; struct FooList { void push_back(Foo &f);

std::vector<Foo> vec_foo_;

};

// FooList.cpp

include "FooList.hpp"

include "Foo.hpp"

void FooList::push_back(Foo &f) { vecfoo.push_back(f); }

// main.cpp

include "FooList.hpp"

int main(int argc, char **argv) { FooList list; return 0; } `