I am on MacOS Mojave 10.14. I can compile wxWidget code and have compiled a few demos, etc. The only feature of wxWidget I cannot compile is a wxRichTextCtrl. Whenever I do the following in my main.cpp file I get error:
wxRichTextCtrl* richTextCtrl = new wxRichTextCtrl(this, -1, wxT(""), wxDefaultPosition,
wxSize(250, 150), wxTE_MULTILINE);
I get this error
Undefined symbols for architecture x86_64:
"wxRichTextCtrl::wxRichTextCtrl(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)", referenced from:
MyFrame::MyFrame(wxString const&, wxPoint const&, wxSize const&) in main-498ba7.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried replacing "this" with a wxPanel, but that results in the same error. The full error report from g++ is:
Apple clang version 11.0.0 (clang-1100.0.33.5)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin /clang" -cc1 -triple x86_64-apple-macosx10.14.0 -Wdeprecated-objc-isa-usage -Werror=deprecated- objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp- elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -ggnu-pubnames -target-linker-version 512.4 -v -resource-dir /Applications /Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0 -I/usr/local/lib/wx/include/osx_cocoa-unicode-static-3.1 -I /usr/local/include/wx-3.1 -D _FILE_OFFSET_BITS=64 -D __WXMAC__ -D __WXOSX__ -D __WXOSX_COCOA__ -stdlib=libc++ -internal-isystem /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 -Wno-framework-include-private-from-public -Wno-atimport-in-framework- header -Wno-extra-semi-stmt -Wno-quoted-include-in-framework-header -fdeprecated-macro -fdebug- compilation-dir /Users/user/Downloads/wxWidgets-3.1.3/build/osx -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mdarwin-stkchk-strong-link -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 -o /var/folders/f3/lvdll7257lq_4_fcysmprc700000gn/T/main-b50747.o -x c++ main.cpp
clang -cc1 version 11.0.0 (clang-1100.0.33.5) default target x86_64-apple-darwin18.7.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/wx/include/osx_cocoa-unicode-static-3.1
/usr/local/include/wx-3.1
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin /../include/c++/v1
/usr/local/include
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /clang/11.0.0/include
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.14.0 -o out -L/usr/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /usr/local/lib/libwx_osx_cocoau_xrc-3.1.a /usr/local/lib/libwx_osx_cocoau_qa-3.1.a /usr/local/lib/libwx_baseu_net-3.1.a /usr/local/lib/libwx_osx_cocoau_html-3.1.a /usr/local/lib/libwx_osx_cocoau_core-3.1.a /usr/local/lib/libwx_baseu_xml-3.1.a /usr/local/lib/libwx_baseu-3.1.a -framework WebKit -lwxregexu-3.1 -lwxscintilla-3.1 -lexpat -lpng -ljpeg -ltiff -lz -framework Security -lpthread -liconv -llzma /var/folders/f3/lvdll7257lq_4_fcysmprc700000gn/T/main-b50747.o -lc++ -lSystem /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"wxRichTextCtrl::wxRichTextCtrl(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)", referenced from:
MyFrame::MyFrame(wxString const&, wxPoint const&, wxSize const&) in main-b50747.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I compile from my terminal using g++ and get my linker options, etc from wx-config --cxxflags and wx-config --libs. I program in xCode. Using gcc instead of g++ results in the same error.
By default, wx-config --libs returns only the "standard" libraries (which basically were all the existing libraries back when this was implemented) and not all the available libraries to make it possible to add more libraries later without changing anything for the applications that don't need them.
So if you need to use a library not included in this "standard subset", you must specify it explicitly, like this: wx-config --libs std,richtext.
Related
I have updated my llvm installation, such that I now use Clang8.
After that I keep getting this error:
Undefined symbols for architecture x86_64:
"std::__1::__fs::filesystem::__status(std::__1::__fs::filesystem::path const&, std::__1::error_code*)", referenced from:
std::__1::__fs::filesystem::is_directory(std::__1::__fs::filesystem::path const&) in main-de2419.o
ld: symbol(s) not found for architecture x86_64
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
So it can find the header for filesystem but not the lib (as I understand). I have this test program:
#include <filesystem>
#include <iostream>
int main(void)
{
auto isDir = std::filesystem::is_directory("./main.cpp");
std::cout << isDir << std::endl;
return 0;
}
And I compile it this way clang++ -std=c++17 main.cpp. If with -v the output is:
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
"/usr/local/Cellar/llvm/8.0.0/bin/clang-8" -cc1 -triple x86_64-apple-macosx10.14.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -ggnu-pubnames -target-linker-version 409.12 -v -resource-dir /usr/local/Cellar/llvm/8.0.0/lib/clang/8.0.0 -stdlib=libc++ -internal-isystem /usr/local/opt/llvm/bin/../include/c++/v1 -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /Users/larsnielsen/Desktop/test/test_filesystem -ferror-limit 19 -fmessage-length 160 -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 -o /var/folders/df/wm8q24k53dz09jn4q35122bw0000gn/T/main-2be1ed.o -x c++ main.cpp
clang -cc1 version 8.0.0 based upon LLVM 8.0.0 default target x86_64-apple-darwin18.2.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/opt/llvm/bin/../include/c++/v1
/usr/local/include
/usr/local/Cellar/llvm/8.0.0/lib/clang/8.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -demangle -lto_library /usr/local/Cellar/llvm/8.0.0/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.14.0 -o a.out /var/folders/df/wm8q24k53dz09jn4q35122bw0000gn/T/main-2be1ed.o -lc++ -lSystem /usr/local/Cellar/llvm/8.0.0/lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"std::__1::__fs::filesystem::__status(std::__1::__fs::filesystem::path const&, std::__1::error_code*)", referenced from:
std::__1::__fs::filesystem::is_directory(std::__1::__fs::filesystem::path const&) in main-2be1ed.o
ld: symbol(s) not found for architecture x86_64
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
I have trieded a few solution options, without success:
I have changed to use <experimental/filesystem>
I have tried to link stdc++fs and c++fs
I have tried to export LDFLAGS="-L/usr/local/opt/llvm/lib" and CPPFLAGS="-I/usr/local/opt/llvm/include"
And I have added this to my .bash_profile export PATH="/usr/local/opt/llvm/bin:$PATH"
I have update LLVM on both my Fedora and macOS, and only the Mac has the issue. I updated using homebrew on macOS.
I'm able to run single file programs but when it comes to multiple files, it will not run. Below is the simple code example and error. I have already tried changing to LLVM Clang from the default GNU GCC compiler but neither seem to work.
I've also already installed Command Line Tools and XCode as I was warned you would need this to have codeblocks working correctly.
This is the main.cpp, Sally.h and Sally.cpp file:
#include <iostream>
#include "Sally.h"
using namespace std;
int main(){
Sally s;
return 0;
}
#ifndef SALLY_H
#define SALLY_H
class Sally
{
public:
Sally();
protected:
private:
};
#endif // SALLY_H
#include "Sally.h"
#include <iostream>
using namespace std;
Sally::Sally()
{
cout << "wuttup" << endl;
}
The error message I'm getting is this:
-------------- Build: Debug in Test (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -I -c /Users/shackletom/Desktop/Test/main.cpp -o obj/Debug/main.o
Undefined symbols for architecture x86_64:
"Sally::Sally()", referenced from:
_main in main-9bf1fd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Edit, apologies, here's the full build log:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.9 -v -dwarf-column-info -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/shackletom/Desktop/Test -ferror-limit 19 -fmessage-length 179 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/yf/ky2mbh0x0b71x9gdz0g8sp940000gn/T/main-885784.o -x c++ main.cpp
clang -cc1 version 7.0.2 based upon LLVM 3.7.0svn default target x86_64-apple-darwin15.3.0
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o test /var/folders/yf/ky2mbh0x0b71x9gdz0g8sp940000gn/T/main-885784.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"Sally::Sally()", referenced from:
_main in main-885784.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Update:
Turns out that while creating the other classes I fixed this problem by making sure "Add paths to project" under File Policy was unticked.
I have a very basic C++ program which I cannot compile using g++ on Mac OSX 10.9.3.
Main.cpp
#include "MyClass.hpp"
int main() {
MyClass::MyClass obj = MyClass::MyClass();
return 0;
}
MyClass.hpp
class MyClass {
public:
MyClass();
void method();
private:
};
MyClass.cpp
#include "MyClass.hpp"
using namespace MyClass;
MyClass() {
};
void method() {
};
To compile it I use g++
g++ main.cpp -o out
Here is what I get as a result :
Undefined symbols for architecture x86_64:
"MyClass::MyClass()", referenced from:
_main in main-2750ac.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I then run g++ main.cpp -o out -v and get this :
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/stan/Documents/Info/Ateliers C++/Ateliers/Drawing -ferror-limit 19 -fmessage-length 120 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/58/ch14y2yx05v7vy1yvrsmy_3m0000gn/T/main-4d20fb.o -x c++ issue/main.cpp
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin13.2.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o out /var/folders/58/ch14y2yx05v7vy1yvrsmy_3m0000gn/T/main-4d20fb.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"MyClass::MyClass()", referenced from:
_main in main-4d20fb.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I get stuck here.
You don't compile MyClass.cpp. Try this:
g++ main.cpp MyClass.cpp -o out
This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 8 years ago.
Here is a very simple C++ program.
// test.h
class Test {
public:
Test();
};
// test.cpp
#include "test.h"
Test::Test()
{
// do something
}
// main.cpp
#include "test.h"
int main() {
Test t;
return 0;
}
I am trying to compile this using clang++ on OSX using this command line and I get this error:
[test]$ clang++ main.cpp -o main
Undefined symbols for architecture x86_64:
"Test::Test()", referenced from:
_main in main-017149.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And here is the compilation with the -v switch:
[test]$ clang++ main.cpp -o main -v
Apple LLVM version 6.0 (clang-600.0.34.4) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
"/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 241 -v -resource-dir /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/ramin/projects/algorithm_examples/test -ferror-limit 19 -fmessage-length 139 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/z5/hyt30v7d7t7_w1xfpdgqp05w0000gn/T/main-d17898.o -x c++ main.cpp
clang -cc1 version 6.0 based upon LLVM 3.5svn default target x86_64-apple-darwin13.2.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/usr/local/include
/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include
/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o main /var/folders/z5/hyt30v7d7t7_w1xfpdgqp05w0000gn/T/main-d17898.o -lc++ -lSystem /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"Test::Test()", referenced from:
_main in main-d17898.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What am I doing wrong?
main.cpp includes test.h; it does not include test.cpp. You can compile and link them at the same time by specifying them both as input:
[test]$ clang++ main.cpp test.cpp -o main
You missed other cpp file:
clang++ main.cpp test.cpp -o main
I'm trying to use threads in C++, using boost's thread library. Clang is giving me an error and I don't know how to interpret it. The file I'm trying to compile is about as minimal as it can get:
#include <iostream>
#include <boost/thread.hpp>
using namespace std;
int main() {
return 0;
}
Here's the transcript:
$ clang++ -std=c++11 -o 4.4 4.4.cpp -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.1
Thread model: posix
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name 4.4.cpp -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 134.9 -v -resource-dir /usr/bin/../lib/clang/4.1 -fmodule-cache-path /var/folders/mt/k4dhhm7d7_7_q6drl3zkjj4r0000gn/T/clang-module-cache -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/thinkpad20/Documents/workspace/cpp/homework4 -ferror-limit 19 -fmessage-length 100 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/mt/k4dhhm7d7_7_q6drl3zkjj4r0000gn/T/4-49j8fE.o -x c++ 4.4.cpp
clang -cc1 version 4.1 based upon LLVM 3.1svn default target x86_64-apple-darwin12.2.1
ignoring nonexistent directory "/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
ignoring nonexistent directory "/usr/include/c++/4.0.0"
ignoring nonexistent directory "/usr/include/c++/4.0.0/i686-apple-darwin8/"
ignoring nonexistent directory "/usr/include/c++/4.0.0/backward"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.2.1
/usr/include/c++/4.2.1/backward
/usr/bin/../lib/clang/4.1/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -o 4.4 /var/folders/mt/k4dhhm7d7_7_q6drl3zkjj4r0000gn/T/4-49j8fE.o -lstdc++ -lSystem /usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init3 in 4-49j8fE.o
"boost::system::generic_category()", referenced from:
___cxx_global_var_init1 in 4-49j8fE.o
___cxx_global_var_init2 in 4-49j8fE.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 help is appreciated! :)
You need to tell clang which libraries to link against. In your case, this is boost_system (that's what the error message tells you) and (as soon as you actually get around to using some threading stuff in your program) boost_thread as well, so compile it like this:
clang++ -std=c++11 -o myapp myfile.cpp -lboost_system -lboost_thread