简体   繁体   中英

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

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?

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.

I am having a similar problem, although I am on a 64bit system, using the 64 bit libxlsxwriter . Yet still get the error codes below.

tutorial1.c:(.text+0x10): undefined reference to `workbook_new'
tutorial1.c:(.text+0x25): undefined reference to `workbook_add_worksheet'
tutorial1.c:(.text+0x7d): undefined reference to `worksheet_write_string'
tutorial1.c:(.text+0xbf): undefined reference to `worksheet_write_number'
tutorial1.c:(.text+0xef): undefined reference to `worksheet_write_string'
tutorial1.c:(.text+0x114): undefined reference to `worksheet_write_formula'
tutorial1.c:(.text+0x120): undefined reference to `workbook_close'
collect2: error: ld returned 1 exit status

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM