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

Multiple definitions #61

Closed
gouarin opened this issue Aug 6, 2017 · 2 comments
Closed

Multiple definitions #61

gouarin opened this issue Aug 6, 2017 · 2 comments
Assignees

Comments

@gouarin
Copy link

gouarin commented Aug 6, 2017

I would like to use cxxopts in several source files but it seems that it is not possible. I have compilation errors mentioning that there exists multiple definitions.

To have an example, I just take the one given in the source code and I have added sum.hpp and sum.cpp with the following content

#ifndef SUM_HPP
#define SUM_HPP

#include "cxxopts.hpp"
double sum(double a, double b);
#endif  
#include "cxxopts.hpp"
#include "sum.hpp"

double sum(double a, double b)
{
    return a + b;
}

And then I have added

#include "sum.hpp"

and I have added the source file sum.cpp in the CMakeLists.txt. When you compile this example, you will have multiple definitions error.

@gouarin gouarin changed the title Mulitple definitions Multiple definitions Aug 6, 2017
@jarro2783 jarro2783 self-assigned this Aug 7, 2017
@jarro2783
Copy link
Owner

I'll take a look at this.

@gouarin
Copy link
Author

gouarin commented Aug 9, 2017

Thanks.

@gouarin gouarin mentioned this issue Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants