cant compile abs::flat_hash_map

14 views
Skip to first unread message

aditya sharma

unread,
Oct 7, 2024, 6:13:56 AM10/7/24
to Abseil.io
I am getting below error while compiling the absl::flat_hash_map sample program
hash.cc:(.text+0x60): undefined reference to `absl::lts_20230802::hash_internal::CityHash32(char const*, unsigned long)'

helloworld.cpp
#include <iostream>
#include "absl/container/flat_hash_map.h"
int main() {
absl::flat_hash_map<int, std::string> map = {{1, "huey"}, {2, "dewey"}, {3, "louie"}};
for (auto it = map.begin(); it != map.end();) {
std::cout<<"it->second[0]"<<it->second[0];it++;
}
return 0;
}
the compile command is as below:
g++ -std=c++17 hello_world.cpp -o newout -L{installDir}/lib64 -labsl_hash -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_synchronization -labsl_raw_logging_internal -labsl_base -I {installDir}/include

I am using gcc11.3.0 and the cmake buildsystem. the sourc code is from GitHub - abseil/abseil-cpp: Abseil Common Libraries (C++)

My issue seems exactly similar to the one here

Can anyone please help on what I am missing in compilation
Reply all
Reply to author
Forward
0 new messages