Can't built Constructors/Destructors example on Mac 10.12.13 CodeBlocks 13.12 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can't built Constructors/Destructors example on Mac 10.12.13 CodeBlocks 13.12

Hi Here's what I'm getting from the builder: " g++ -Wall -fexceptions -g -I -c /Users/me/Documents/Programming/CPP/Sololearn/main.cpp -o obj/Debug/main.o Undefined symbols for architecture x86_64: "MyClass::MyClass()", referenced from: _main in main-042e61.o "MyClass::~MyClass()", referenced from: _main in main-042e61.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) " My files are as follows Main.

16th Feb 2017, 3:34 PM
Gribanov Andrey
Gribanov Andrey - avatar
1 Answer
+ 1
I figured out what the problem was. It has to do with debugger configuration. Basically this is the description of the issue. Quote: "The problem is caused by Apple switching away from GDB, the GNU debugger, to LLDB, the LLVM debugger, in their Xcode toolchain (along with the transition from GCC to Clang). Unfortunately, Eclipse is not capable of communicating with any debugger other than GDB (yet)." Unquote CodeBlocks does look like an Eclipse offspring, and truly it inherited the problem and the solution works like charm: 1) install homebrew 2) Run this in terminal: brew install gdb 3) Authorize gdb to run on your Mac via keychain certification 4) Go Settings->Debugger and fill in the executable path with gdb location.(mine is /usr/local/bin/gdb) Everything in detail here: https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html
16th Feb 2017, 10:32 PM
Gribanov Andrey
Gribanov Andrey - avatar