hbf / miniball

Fast computation of the smallest enclosing ball of a point set, in low or moderately high dimensions.
133 stars 41 forks source link

Error building the Getting Started C++ example #27

Closed Filco306 closed 4 years ago

Filco306 commented 4 years ago

Hello! Thank you for a great repo. I am however running into issues when trying to follow your example.

When I run g++ -I../main example.C -o example -O3, I get

Undefined symbols for architecture x86_64:
  "Seb::Timer::lapse(char const*)", referenced from:
      _main in example-e56615.o
  "Seb::Timer::start(char const*)", referenced from:
      _main in example-e56615.o
  "Seb::Timer::instance()", referenced from:
      _main in example-e56615.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Running it again but with -v, i.e., g++ -v -I../main example.C -o example -O3 gives me

Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.14.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name example.C -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=10.14 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 450.3 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/10.0.1 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I ../main -I/usr/local/include -stdlib=libc++ -O3 -Wno-atomic-implicit-seq-cst -Wno-framework-include-private-from-public -Wno-atimport-in-framework-header -Wno-quoted-include-in-framework-header -fdeprecated-macro -fdebug-compilation-dir /Users/filipcornell/Desktop/PHD/Code/miniball/cpp/test -ferror-limit 19 -fmessage-length 238 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.14.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/folders/nr/fy4ns0011r79q2cn7ww9jvs80000gn/T/example-c70ddd.o -x c++ example.C
clang -cc1 version 10.0.1 (clang-1001.0.46.4) default target x86_64-apple-darwin18.7.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 ../main
 /usr/local/include
 /Library/Developer/CommandLineTools/usr/include/c++/v1
 /Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include
 /Library/Developer/CommandLineTools/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o example /var/folders/nr/fy4ns0011r79q2cn7ww9jvs80000gn/T/example-c70ddd.o -L/usr/local/lib -lc++ -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "Seb::Timer::lapse(char const*)", referenced from:
      _main in example-c70ddd.o
  "Seb::Timer::start(char const*)", referenced from:
      _main in example-c70ddd.o
  "Seb::Timer::instance()", referenced from:
      _main in example-c70ddd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any idea what might be the problem?

Thanks in advance!

MarekBiolik commented 4 years ago

Try: g++ -I../main example.C -o example -O3 ../main/Seb_debug.C

or remove lines with "Seb::Timer" from example.C

Filco306 commented 4 years ago

Thank you, your command worked now. Closing this issue.