Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
828 stars 229 forks source link

x86/Win32 compilation and using boost json #309

Closed johandanforth closed 7 months ago

johandanforth commented 10 months ago

What's your question?

How to compile jwt-cpp in an existing win32 c++ library, using boost json?

Additional Context

My c++ skills are really lousy, but I need to integrate jwt-cpp into an existing win32 library, preferably using boost json if possible. Can someone please help me into the right direction. I'm using Visual Studio 2022 and get weird compiler errors regarding openssl, like this:

1>C:\asd\Downloads\openssl-3.1.2\openssl-3.1.2\include\openssl\opensslconf.h(14,11): fatal  error C1083: Cannot open include file: 'openssl/configuration.h': No such file or directory

I downloaded the latest openssl code, and there is only a configuration.h.in file. Tried to rename it, but I get a million other errors after that.

Sorry about the noob question, but I've spent days on trying to verify jwt tokens in a win32 c++ library... In c# I did it in 5 minutes :/

Thalhammer commented 10 months ago

From what I can tell just looking at your description and the error message, it seems like you didn't install openssl correctly (only copied the source files and not building it). Unlike jwt-cpp, which is a header only library and can just be dropped into the project, you need to build openssl, during which the configuration.h.in file should get filled with information about your build and renamed to configuration.h.

Assuming you use visual studio for development the easiest way to get everything working would be to use the nuget package for both jwt-cpp and openssl. If you don't use visual studio or don't want to use nuget, you can install a prebuilt version of it like this.

prince-chrismc commented 7 months ago

As this is a problem with installing dependencies, I am going to close this.

As Thalhammer mentioned, you should really look into using a package manager, given you need at least three it makes it a ton easier, Nuget, VCPKG, and Conan are great options to look into :)