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 definition Error #34

Open
CarlyAmar opened this issue May 28, 2019 · 0 comments
Open

Multiple definition Error #34

CarlyAmar opened this issue May 28, 2019 · 0 comments

Comments

@CarlyAmar
Copy link

CarlyAmar commented May 28, 2019

My code is set up as follows:

main.h

#include "helper.h"

helper.h

#include "subprocess.hpp"

helper.cpp

#include "helper.h"

Error:


Because of this, I get:

main.cpp.o: In function std::iterator_traits<unsigned char const*>::iterator_category std::__iterator_category<unsigned char const*>(unsigned char const* const&)': subprocess.hpp:152: multiple definition of subprocess::util::quote_argument(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, bool)'
main.cpp.o:/subprocess.hpp:152: first defined here
helper.cpp.o: In function std::vector<char*, std::allocator<char*> >::reserve(unsigned int)': /subprocess.hpp:152: multiple definition of subprocess::util::quote_argument(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, bool)'
main.cpp.o:/subprocess.hpp:152: first defined here
collect2: error: ld returned 1 exit status

Solution


This is easily solved by changing void quote_argument(const std::wstring &argument, std::wstring &command_line, bool force) to inline void quote_argument(const std::wstring &argument, std::wstring &command_line, bool force)

* Filenames changed for privacy.

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

1 participant