docopt / docopt.cpp

C++11 port of docopt
Boost Software License 1.0
1.05k stars 146 forks source link

Undefined reference to docopt::docopt #59

Closed peschkaj closed 8 years ago

peschkaj commented 8 years ago

When attempting to build the example code, I get the following compiler error using both g++ ((Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609) and clang (3.8.0-2ubuntu4):

CMakeFiles/projector.dir/main.cpp.o: In function `main':
/home/jeremiah/src/peschkaj/projector/main.cpp:32: undefined reference to `docopt::docopt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/home/jeremiah/src/peschkaj/projector/main.cpp:38: undefined reference to `docopt::operator<<(std::ostream&, docopt::value const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/projector.dir/build.make:124: recipe for target 'projector' failed
make[2]: *** [projector] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/projector.dir/all' failed
make[1]: *** [CMakeFiles/projector.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

This is on Ubuntu 16.04.1

peschkaj commented 8 years ago

Ignore me, I have no idea how to computer

nabijaczleweli commented 8 years ago

:D

PRESFIL commented 6 years ago

same problem with gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1~16.04) + qmake on Linux Mint 18.2 ~/QtCreator-projects/searcher/src/docopt/main.cpp:29: error: undefined reference todocopt::docopt(std::string const&, std::vector<std::string, std::allocator > const&, bool, std::string const&, bool)' ~/QtCreator-projects/searcher/src/docopt/main.cpp:32: error: undefined reference to docopt::operator<<(std::ostream&, docopt::value const&)' :-1: error: collect2: error: ld returned 1 exit status

jaredgrubb commented 6 years ago

looks like you're not compiling all the files.