0

I previously built a programme in C#, now I wanted to write it in C++ to learn this language a bit. I need access to an xlsx file and I want to use XLNT library. The problem is I have absolutely no idea how to get it to work. I read some other topics on SO but nothing makes sense to me at all. First of all, isn't there a simple way to use this library? Like, when I wanted to add a library in C# I just installed the NuGet package and that was all, it simply worked. Isn't it that simple in C++ as well? From what I read so far in the other topics, it seems that I have to use a tool called CMake (again, isn't there a simpler way?). But I have no idea how to do that. What I did so far was:

  1. I downloaded CMake installer and installed CMake

  2. I downloaded xlnt zip file from GitHub and extracted it

  3. I opened CMake GUI and:

    a) as the source code folder I put this: C:/Users/Admin/Downloads/xlnt-master (this is the folder to wchich I extracted the zip file)

    b) as the build folder I put this: C:/Users/Admin/Downloads/xlnt-master/build (I created the build folder after extracting the zip)

    c) I clicked configure and left everything as default, except I changed the Visual Studio Version to 2019

    d) I clicked generate and then I get an error message 'Error in generation process, project files may be invalid'. And it says this in the CMake Window:

'CMake Error at third-party/libstudxml.build/CMakeLists.txt:52 (add_library): Cannot find source file:

C:/Users/Admin/Downloads/xlnt-master/third-party/libstudxml/libstudxml/parser.cxx

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc

CMake Error at third-party/libstudxml.build/CMakeLists.txt:52 (add_library): No SOURCES given to target: libstudxml '

Another solution that I tried was finding the NuGet package called xltn and install it. After trying to compile the programme, though, I get two errors:

  1. cannot open file 'xlntd.lib'
  2. "link.exe" exited with code 1104
  • Check that directory `C:/Users/Admin/Downloads/xlnt-master/third-party/libstudxml` exists. If it is not, then you forget to initialize a **submodule** in it (this is how this directory looks in web: https://github.com/tfussell/xlnt/tree/master/third-party). Probably, creating an archive doesn't work with submodules. It is better to clone the project using regular `git clone --recurse-submodules` (https://stackoverflow.com/questions/3796927/how-do-i-git-clone-a-repo-including-its-submodules). – Tsyvarev Oct 12 '22 at 13:46

0 Answers0