open-source-parsers / open-source-parsers/jsoncpp

Cannot install amalgamated jsoncpp in MFC application

Open
#1,375 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug build
Dominant language
C++
Stars
8.9k
Forks
2.7k
Avg merge
31m
Merged PRs (30d)
1

Description

I tried to install the amalgamated version of jsoncpp by pasting json.h, json-forwards.h to the Header files folder and jsoncpp.cpp to the Source files folder and even included the "include" folder in the project properties. Basically installed it the recommended way, but I kept getting:

jsoncpp.cpp(2492,1): warning C4005: 'ALIGNAS': macro redefinition
jsoncpp.cpp(2490): message : see previous definition of 'ALIGNAS'
jsoncpp.cpp(4113,1): warning C4005: 'isnan': macro redefinition
jsoncpp.cpp(4099): message : see previous definition of 'isnan'
jsoncpp.cpp(4118,1): warning C4005: 'isfinite': macro redefinition
jsoncpp.cpp(4103): message : see previous definition of 'isfinite'
jsoncpp.cpp(4130,1): warning C4005: 'isfinite': macro redefinition
jsoncpp.cpp(4118): message : see previous definition of 'isfinite'
jsoncpp.cpp(4138,1): warning C4005: 'isfinite': macro redefinition
jsoncpp.cpp(4130): message : see previous definition of 'isfinite'
jsoncpp.cpp(4145,1): warning C4005: 'isnan': macro redefinition
jsoncpp.cpp(4113): message : see previous definition of 'isnan'
jsoncpp.cpp(4150,1): warning C4005: 'isfinite': macro redefinition
jsoncpp.cpp(4138): message : see previous definition of 'isfinite'
jsoncpp.cpp(5343,1): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source?

I also have tried following what the last error told me to do and added "#include "pch.h"" in the jsoncpp.cpp file but instead of getting the above I got:

jsoncpp.cpp(843,47): warning C4003: not enough arguments for function-like macro invocation 'max'
jsoncpp.cpp(843,47): error C2589: '(': illegal token on right side of '::'
soncpp.cpp(843): error C2062: type 'unknown-type' unexpected
jsoncpp.cpp(843,52): error C2059: syntax error: ')'
jsoncpp.cpp(845,5): error C2181: illegal else without matching if
jsoncpp.cpp(1895,47): warning C4003: not enough arguments for function-like macro invocation 'max'
jsoncpp.cpp(1895,47): error C2589: '(': illegal token on right side of '::'
jsoncpp.cpp(1895): error C2062: type 'unknown-type' unexpected
jsoncpp.cpp(1895,52): error C2059: syntax error: ')'
jsoncpp.cpp(1897,5): error C2181: illegal else without matching if

Does anybody know if there's actually any way to use amalgamated jsoncpp in an MFC Application? I've been dealing with this for 2 days and it'd be very much appreciated

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the amalgamated jsoncpp.cpp, json.h, and json-forwards.h files together with the MFC project's precompiled-header settings. Reproduce the reported C4005, C1010, and max-related errors; done means determining whether this setup is supported and documenting a reproducible fix or incompatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.