首页 > 解决方案 > 如何在c++程序中添加rapidjson头文件

问题描述

实际上我在我的项目中添加了 rapidjson 文件。但是在编译这个程序时,它向我显示了一个错误。

错误信息

[错误] rapidjson.h:没有这样的文件或目录

编译终止。

D:\Ramya\Makefile.win 目标“main_1.o”的配方失败

这里 main_1 是我的文件名。

请任何人帮助我。谢谢 !

#include <iostream>
#include <stdlib.h>
#include "rapidjson.h"
#include "document.h"

using namespace std;

using namespace rapidjson;

Document document;


void parse_file(void)
{
    
    /* Open the example.json file in read mode */
        FILE* fp = fopen("example.json", "r"); 

        /* Declare read buffer */
        char readBuffer[65536];

        /* Declare stream for reading the example stream */
        FileReadStream is(fp, readBuffer, sizeof(readBuffer));


        /* Parse example.json and store it in `document` */
        document.ParseStream(is);

        /* Close the example.json file*/
        fclose(fp);
    
}



int main()
{
    char name[50];
    int t_value;
    parse_file();
    return 0;
    
}




    

标签: c++error-handlingheader-filesdev-c++rapidjson

解决方案


推荐阅读