rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.17k stars 439 forks source link

RTTR_REGISTRATION never invoked #245

Closed DerGaijin closed 5 years ago

DerGaijin commented 5 years ago

Hello i am using your library (static) in my own library (static) and maybe that doesn't have to do anything but if i create a .cpp file in my library just for registering some classes (only auto RTTR_REGISTRATION) the function never gets invoked so the classes are not registered.. maybe its the compiler (Visual Studio 15 2017) who says the file is empty and not building it in my library Just wanna let you know :)

vamidi commented 5 years ago

It might be that your header and source file are not being compiled, because they are not needed. if you registrate a class you need to make sure you are exactly using it. try using inside main.cpp new class() also include std::cout for testing purposes. you can see in the console if the compiler is doing something with your registration.

RTTR_REGISTRATION
{
    std::cout << "Creating reflection for: className" << std::endl;
// .... rest of the code