undefined reference to [...] when building program with libxlsxwriter

923 Views Asked by At

I'm trying to make a program that interacts with MS Excel using libxlsxwriter. I'm using MSYS2 with Mingw-w64 to build my application. Whenever I try to compile my code with the 64-bit version of gcc, everything works flawlessly; however, If I try to compile with the 32-bit version of gcc, it gives me this kind of error for every function I use: C:\msys64\tmp\ccknaH4k.o:main.cpp:(.text+0x16): undefined reference to 'workbook_new'. What could it be?

1

There are 1 best solutions below

11
On

The library appears to have been built for 64-bit only, so when you try to link a 32-bit binary with it, the linker is only able to find 64-bit symbols, not 32-bit ones.

To solve this, you'll have to compile or download a 32-bit version of the library.