I have to use jsonxx library in my project. But calling this line jsonxx::Object out; throws an error - `undefined reference to jsonxx::Object::Object()'` and `undefined reference to jsonxx::Object::~Object()'`
Here is the full code
1 2 3 4 5 6
#include "jsonxx.h"
int main()
{
jsonxx::Object out;
}
I put both jsonxx.h and jsonxx.cc next to main.cpp. So there are three files in the folder. Then run the code as usual (with VS Code extension). Maybe jsonxx needs some special tools for running?
How does it know what files to compile? It's not compiling every file on your hard drive, right? So somehow, it knows which files to compile? How does it know?
However it knows, it's missing the one that contains the code that is jsonxx::Object::Object() (the constructor for a jsonxx::Object) and the code that is jsonxx::Object::~Object() (the deconstructor for a jsonxx::Object)
Your issue is that the code in your main is not being linked with the code in jsonxx.cc. That's all I can say without knowing more information.
Is jsonxx.cc being compiled?
What commands are being run to compile your project?
That's a different error now. If that's on line 3, I assume that means you didn't #include anything? The line number no longer matches your original post, so it means your code is changed.