marzer / tomlplusplus

Header-only TOML config file parser and serializer for C++17.
https://marzer.github.io/tomlplusplus/
MIT License
1.55k stars 148 forks source link

missing include #232

Open Carmelo908 opened 2 months ago

Carmelo908 commented 2 months ago

Environment

toml++ version and/or commit hash:
3.4.0

Compiler: g++ 13.1.0

C++ standard mode:
C++17

Target arch:
x64

Library configuration overrides:
None

Relevant compilation flags:
None

Describe the bug

I installed the library with vcpkg and added the toolchain file with CMake, then tried to compile my program and I got an error from the compiler:

.../vcpkg_installed/x64-linux/include/toml++/impl/date_time.hpp:337:17: error: ‘optional’ does not name a type

I went to the file and added "#include " at the top. it worked and I could compile

marzer commented 2 months ago

This should not be the case if you are including the library 'normally'. 🤔 Can you show me the code that caused this, specifically, how were you #including toml++?

Carmelo908 commented 2 months ago

I used #include <toml++/toml.hpp> but I think maybe I'm suposed to just include in the same file

marzer commented 2 months ago

No, you did the right thing. Looks like there's something amiss. I'll look into it, thanks 😃