나는 다음과 같은 코드를 실행하면 : 내가 읽고하는 프로그램을 작성하는 것을 시도하고있다정의되지 않은 참조 JSON :: 가치와 JSON :: 리더
undefined reference to `Json::Reader::Reader()'
undefined reference to `Json::Value::Value(Json::ValueType)'
:
#include <cstdio>
#include <iostream>
#include <fstream>
#include <cstring>
#include <C:\Users\User\Documents\jsoncpp-master\dist\json\json.h>
#include <C:\Users\User\Documents\jsoncpp-master\dist\json\json-forwards.h>
using namespace std;
int main(){
Json::Value root;
Json::Reader reader;
ifstream file("test.json");
return 0;
}
나는 다음과 같은 오류를 얻을 수를 JSON 파일과이 코드는 다른 C++ 모듈에서 사용할 JSON 파일에 데이터를 출력해야합니다.
나는 전체 링크를 제거하려면 코드를 변경하고 내가 실행 한 후 내가 가진의 dist 폴더를 삽입 한
#include <cstdio>
#include <iostream>
#include <fstream>
#include <cstring>
#include "dist\jsoncpp.cpp"
using namespace std;
int main(){
Json::Value root;
Json::Reader reader;
ifstream file("test.json");
return 0;
}
UPDATE :
python amalgamate.py
내가 C로 헤더 파일을 입력을 : \ MinGW \ include
이제 jsoncpp.cpp 파일에 많은 오류가 발생합니다. (이 파일은 python 명령을 실행 한 후 얻은 파일이므로 전혀 변경하지 않았습니다.)
first defined here
여기서'Json' 클래스는 정의 되었습니까? – MicroCheapFx
** 링커 ** 오류. jsoncpp 라이브러리와 링크해야합니다. – Jarod42
[OT] : 포함에 전체 경로를 사용하지 마십시오. 빌드 시스템에 추가 디렉토리를 지정하여 헤더를 찾으십시오. – Jarod42