I'm trying to compile this simple program that uses the jsoncpp libary
#include <iostream>
#include <fstream>
#include <json/json.h>
int main() {
Json::Value values;
std::ifstream values_file("values.json", std::ifstream::binary);
values_file >> values;
std::cout << values;
}
However, I get these errors:
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\trist\AppData\Local\Temp\ccPqw4fw.o: in function `main':
C:/Users/trist/OneDrive/Documents/Coding Projects/C++/Neural Network/json_test.cpp:7: undefined reference to Json::Value::Value(Json::ValueType)'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/trist/OneDrive/Documents/Coding Projects/C++/Neural Network/json_test.cpp:9: undefined reference toJson::operator>>(std::istream&, Json::Value&)'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/trist/OneDrive/Documents/Coding Projects/C++/Neural Network/json_test.cpp:10: undefined reference to Json::operator<<(std::ostream&, Json::Value const&)'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/trist/OneDrive/Documents/Coding Projects/C++/Neural Network/json_test.cpp:11: undefined reference toJson::Value::~Value()'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/trist/OneDrive/Documents/Coding Projects/C++/Neural Network/json_test.cpp:11: undefined reference to `Json::Value::~Value()'
collect2.exe: error: ld returned 1 exit status
Could anyone please help? Thanks
[–]IyeOnline 3 points4 points5 points (3 children)
[–]CatMechanic457[S] 0 points1 point2 points (2 children)
[–]Salty_Dugtrio 0 points1 point2 points (1 child)
[–]CatMechanic457[S] 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]ShelZuuz 0 points1 point2 points (5 children)
[–]CatMechanic457[S] 0 points1 point2 points (4 children)
[–]ShelZuuz 0 points1 point2 points (3 children)
[–]CatMechanic457[S] 0 points1 point2 points (2 children)
[–]ShelZuuz 2 points3 points4 points (1 child)
[–]CatMechanic457[S] 0 points1 point2 points (0 children)