Im trying to read excel sheets of xlsx file and convert each sheet to a csv file using libxl
i downloaded libxl 4.1.0 and followed this steps to integrate libxl in my code: https://www.libxl.com/codeblocks.html this is my code:
#include <iostream>
#include <fstream>
#include <string>
#include "libxl.h"
using namespace std;
using namespace libxl;
int main() {
Book* book = xlCreateBook();
if(book) {
if(book->load("0FUP3B0YZS_results.xls")) {
int sheetCount = book->sheetCount();
for(int i = 0; i < sheetCount; ++i) {
Sheet* sheet = book->getSheet(i);
if(sheet) {
string csvFileName = sheet->name() + ".csv";
ofstream csvFile(csvFileName.c_str());
if(csvFile.is_open()) {
int rowCount = sheet->lastRow();
for(int row = 0; row <= rowCount; ++row) {
int colCount = sheet->lastCol();
for(int col = 0; col <= colCount; ++col) {
csvFile << sheet->readStr(row, col).c_str();
if(col != colCount) {
csvFile << ",";
}
}
csvFile << endl;
}
csvFile.close();
}
}
}
}
book->release();
}
return 0;
}`
but i always get this eror: undefined reference to xlCreateBook Can you please tell me what to do to be recognized in my code?