c++17 -> c++11
souch opened this issue · comments
hi,
In order to make it works easily on old Linux version, I would prefer that the lib can compile with c++11. Is that possible, or am I missing something ?
I personally am not a fan of backwards compability, as it only limits one in what they can do. Thus, I try to keep it at a minimum and no, the current version of the library requires c++17.
Eariler versions, i.e. 1.* releases only require c++14. But C++11 was never used for this project. I made the jump eariler then planned (i.e. before c++20 is out), because of the major version bump.
However, this does not mean it won't be possible to compile with c++11. Simply change the line in .qmake.conf and see, what the compiler tells you. Many things added in newer versions of the c++ standard are purely "cosmetic". For example:
- using chrono literals, e.g
10s
instead ofstd::chrono::seconds(10)
- implicit constructors instead of the
std::make_*
methods
I am always willing to help out, if you encounter something not easily backportable to c++11. There shouldn't be to many problems, as the library mostly uses Qt classes and only rarely the stl. Again, just try it out and if you encounter problems, post them here so we can make it work.
Also, if you eventually get a working variant, feel free to tell me, so I can link your port in the readme.
Thanks for the fast reply !
I didn't try to recompile QtService, I used the release binary instead.
If I set my project to CONFIG += c++11, It complains in QtService/qtservice_helpertypes.h about std::index_sequence and std::make_index_sequence.
Thank you for willing to help me. Sorry for that, I will try first the old QtService from qt-solutions as it handles c++11 and does not need to compile the code as an external lib. For now, it works ok on mingw-Windows. I still didn't try it on linux systemd/sysvinit. I'll perhaps switch back to your lib if linux is not well supported on the old QtService.
Ah right, the helpers... Well, they are only used for some generic stuff that is far from beeing required. You could simply delete the file and uncomment whatever used it. As far as I can remember, it is only used by the QtService::Service::addCallback.
Regarding the Qt-Solutions library: I was inspired to create this one because the Qt solutions does not integrate with systemd (or for macos: launchd) at all... All it does is "daemonize" the process.
Ok, thanks for the advice, my service operations are basic (start/stop) so I'll stick with old qtservice for now.