Closed NickCullen closed 7 years ago
Hi. Did you define PONDER_USES_RUNTIME_IMPL in a header? It should be in one implementation file before ponder headers.
For an example, see the Lua test.
I.e. in *.cpp file:
#define PONDER_USES_LUA_IMPL
#define PONDER_USES_RUNTIME_IMPL
#include <ponder/class.hpp>
#include <ponder/detail/format.hpp>
#include <ponder/classbuilder.hpp>
#include <ponder/uses/lua.hpp>
#include <list>
If you put these defines in the project settings, or a header that is multiply included then you'll get these symbols multiply defined. See header that defines them.
Hey thanks for the reply, sorry I am late coming back - I had to come away from the computer for a few days!
I had both PONDER_USES_LUA/RUNTIME_IMPL defined as a project-wise definition - would this cause that issue?
As I knew what the compiler was complaining about (duplicate definition across more than one object file) I looked at using a unity build solution for compiling all my .conf.cpp files into one object. This forced the symbols to be built into a single (hence only having 1 definition) object file ReflectableClasses.o
Working too hard?!
Yes that would cause a problem. Don't put the defines in project settings, put before includes in one implementation. For unity build undefine them after the headers.
Need to document this better.
I'll close this as I think this should work for you now. Re-open if now.
Hi,
I am getting multiple defined symbol errors like so
obj/Debug/Sandbox/Mathf.conf.o: In function ponder::runtime::ObjectFactory::construct(ponder::Args const&, void*) const: Mathf.conf.cpp:(.text+0x168): multiple definition of ponder::runtime::ObjectFactory::construct(ponder::Args const&, void*) const obj/Debug/Sandbox/Vector2.conf.o:Vector2.conf.cpp:(.text+0x1a2): first defined here
I can successfully compile and run when I use ponder to build one of these classes (say Mathf) but as soon as I introduce another class (Vector2f) I get the above error. I understand why the error would be caused after quite a lot of digging about but I can't figure out why it is happening in this case.
My set up is as follows:
Mathf.h
Mathf.cpp
Mathf.conf.cpp
Vector2f.h, Vector2f.cpp & Vector2f.conf.cpp uses the exact same set up as described above so I won't write out that code as well...
I have tried linking to ponder both statically and dynamically and tested on Windows, Mac and Linux (Ubuntu) but I am still getting the same error.
Any ideas why this is happening? I've been trying to overcome this issue for 3 days now but have had no luck :(
Here is the full output from the compiler error: