Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile with clang #21

Open
techbech opened this issue Dec 20, 2020 · 3 comments
Open

Cannot compile with clang #21

techbech opened this issue Dec 20, 2020 · 3 comments
Labels
bug Something isn't working difficulty: VERY LOW Task with very low difficulty priority: HIGH Task with high priority

Comments

@techbech
Copy link

techbech commented Dec 20, 2020

Building with clang fails because of the naming collision between the namespace dotenv and the class dotenv.

Version

clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Some of the build errors

***/cpp-dotenv/src/dotenv.cpp:14:1: error: reference to 'dotenv' is ambiguous
dotenv::dotenv& dotenv::dotenv::load_dotenv(const string& dotenv_path, const bool overwrite, const bool interpolate)
^
***cpp-dotenv/src/Parser.h:13:11: note: candidate found by name lookup is 'dotenv'
namespace dotenv
          ^
***/cpp-dotenv/include/dotenv.h:9:11: note: candidate found by name lookup is 'dotenv::dotenv'
    class dotenv
          ^
***/cpp-dotenv/src/dotenv.cpp:14:17: error: reference to 'dotenv' is ambiguous
dotenv::dotenv& dotenv::dotenv::load_dotenv(const string& dotenv_path, const bool overwrite, const bool interpolate)
                ^

Solution could be to rename the dotenv class #22

@adeharo9
Copy link
Owner

Yep, I've found myself in that situation a couple of times (not with clang but with g++) and managed to sort it out eventually, but didn't think the problem would appear again.

Definitely renaming seems the way to go to avoid further headaches.

@adeharo9
Copy link
Owner

I think I'm going to go for something more like renaming the namespace (cppdotenv maybe, I don't know yet) and introduce a similar, coherent scoping structure in CMake (basing myself in the already-stable interfaces of good projects like this one).

Probably will introduce these changes for v1.0.0-beta and try to stabilize the interface at that version so v1.0.0 can be out and stable as soon as possible.

@adeharo9 adeharo9 added bug Something isn't working difficulty: VERY LOW Task with very low difficulty priority: HIGH Task with high priority labels Apr 27, 2021
@cieslarmichal
Copy link

Hey, could not use a library because of this issue, I used dotenv-cpp lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working difficulty: VERY LOW Task with very low difficulty priority: HIGH Task with high priority
Projects
None yet
Development

No branches or pull requests

3 participants