DataFrame: Undefined reference to `hmdf::HeteroVector::clear()'
When I tried to smoke test my code, I found that even trying to declare a dataframe resulted in an error at compile time. Am I missing a header file?
I’m running Debian 10 and am not using an IDE - I’m simply using g++ (I will create a Makefile once my code makes it past the smoke test). Below is the command I am using and the corresponding error.
username@system:/tmp/smoke_test$ g++ test_dataframe.cpp -I DataFrame/include/ -std=gnu++17 -o test_dataframe
/usr/bin/ld: /tmp/ccjU2Oy0.o: in function hmdf::HeteroVector::~HeteroVector()': test_dataframe.cpp:(.text._ZN4hmdf12HeteroVectorD2Ev[_ZN4hmdf12HeteroVectorD5Ev]+0x14): undefined reference to
hmdf::HeteroVector::clear()’
collect2: error: ld returned 1 exit status
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (7 by maintainers)
Your understanding of the compile process is incorrect. Also, your understanding of what role header files play is incorrect. I still suggest you put some time aside to read up on them.
I still see problems:
/usr/local/include/DataFrame/
. I highly doubt that is where the library is. And if it is there somehow, it shouldn’t be.This is a typical line for compiling an object file
And this is a typical line to link an executable
It works! Thank you!
There is nothing wrong with your
#include
. You are not failing at compiling your program. You are failing at linking your program. That means you are failing to link to DataFrame library to resolve all the external symbols. Now that you have successfully made the DataFrame you have to link with its library on your compiling command line. So change your command line to something likeThat is a typical command line to compile and link any C++ program using a library, whether it is a very simple program or very complicated.
Hope that helps