FlorianRappl / CmdParser

A simple and lightweight command line parser using C++11.
MIT License
166 stars 44 forks source link

Compile fails in MSVC with /clr #17

Open MrSapps opened 6 years ago

MrSapps commented 6 years ago

Seems you can't have a namespace called "cli" when building with /clr.

error C3292: the cli namespace cannot be reopened

FlorianRappl commented 6 years ago

Yeah the Microsoft compiler (esp. with the CLR target) was never the main objective / target for this library, but supporting the build would be desirable. I just fear it would be a breaking change. Maybe have a macro depending on the compiler / flags to switch the namespace (i.e., use "cli" for non-CLR target and "ncli" or similar for CLR)?

Not sure if there is a compiler directive check we can apply here (which one). Would be happy if somebody could come up with a solution / PR. Any help appreciated!

MrSapps commented 6 years ago

Yeah I'm just sure.. I just hacked my local copy by renaming the namespace..

zoulunkai commented 5 months ago

Despite successfully building the project without /clr, I encountered debugging issues. Specifically, the MSVC2022 debugger couldn't inspect variables within the Parser class in debug mode. Renaming the "cli" namespace resolved this issue.

FlorianRappl commented 5 months ago

Again as per my comment if there is a directive that only applies in case of MSVC we could circumvent this. Otherwise this is more a bug in MSVC as it's not behaving standards compliant.