Jatana / FastOlympicCoding

Tools for competitive programming for Sublime Text 3 & 4
399 stars 48 forks source link

Linkage for C++ with libXL library #11

Closed abhi3700 closed 5 years ago

abhi3700 commented 5 years ago

I was trying to compile C++ with libXL for Excel.

Here is the code:

#include <iostream>
#include "../libxl/include_cpp/libxl.h"

using namespace libxl;

int main() 
{
    Book* book = xlCreateBook(); // xlCreateXMLBook() for xlsx
    if(book)
    {
        Sheet* sheet = book->addSheet(/*L*/"Sheet1");
        if(sheet)
        {
            sheet->writeStr(2, 1, /*L*/"Hello, World !");
            sheet->writeNum(3, 1, 1000);
        }
        book->save(/*L*/"example.xls");
        book->release();
    } 
    return 0;
}

It is giving this error:

C:\Users\abhijit\AppData\Local\Temp\cc2Ip6Ru.o:test2.cpp:(.text+0xf): undefined reference to `xlCreateBookA'

collect2.exe: error: ld returned 1 exit status

I think there is some linkage issue. How can I fix/include this in the package for Sublime editor?

E.g. in Qt C++ package:

   - add the following lines to a configuration file (.pro):

     INCLUDEPATH = c:/libxl-3.6.4.0/include_cpp
     LIBS += c:/libxl-3.6.4.0/lib/libxl.lib

   - copy bin\libxl.dll to the build directory of your project 

Please help!

abhi3700 commented 5 years ago

No response... So, closing the issue