You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
My code is set up as follows:
main.h
helper.h
helper.cpp
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)
toinline void quote_argument(const std::wstring &argument, std::wstring &command_line, bool force)
* Filenames changed for privacy.
The text was updated successfully, but these errors were encountered: