Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Linker Errors

Vin ParVin Par Member Posts: 2

Hello,

I would like to get your thoughts on the following linker errors I am getting for the code segment reproduced below. The code was compiled using the following command on macOS High Sierra 10.13.2:

g++ -ggdb -Wall -std=c++11 database.cpp error.cpp func_objs.cpp main.cpp sampler.cpp -o DB_sampler

The following are the linker errors that I get:

Undefined symbols for architecture x86_64:
"sampler::generate_sample()", referenced from:
_main in main-585927.o
"sampler::sampler(database const&, double)", referenced from:
_main in main-585927.o
"func_objs::create_db_from_file::create_db_from_file(database&)", referenced from:
database::read_from_file() in database-d7bc7e.o
"func_objs::create_db_from_file::operator()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)", referenced from:
database::read_from_file() in database-d7bc7e.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 shared at the below link, the source code from the various source files (and the corresponding header files) included in the command line above. The program is intended to sample a database (contained in a file on the disk). I am presuming that the design would be evident from the source code.

Link to Source Code

I would really appreciate your thoughts. This is not a homework exercise, but rather a question that I am attempting as part of securing a job interview. So kindly share your thoughts.

Best wishes
Vinod

Tagged:
Sign In or Register to comment.