How to fix C++ linking error: undefined reference to symbol 'crc32'


While trying to compile your C++ program, during the linking stage, you see an error message such as

/bin/ld: minio-cpp/src/utils.o: undefined reference to symbol 'crc32'
/bin/ld: /lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status


TheĀ crc32 symbol is defined in zlib. Hence, you need to link zlib by adding


to your linker flags. If you don’t know where your linker flags are, try just adding it to your compiler flags.