How to compile/build/link - the XLNT library? - c++

I downloaded the xlnt library for working with Excel - https://github.com/tfussell/xlnt. Can you please tell me what to do with it further? Honestly, I still can’t understand how among all the files there are in the downloaded archive, and there are 100 of them .hpp and .cpp files, what should I do with them?
1)As far as I understand, they need to be processed by the Cmake program and it seems that the output should appear .lib file, but I absolutely can’t understand how to do it or maybe something else
2)Or how can they be directly processed by Visual Studio 2017?
PS:When I launch Smack, I select the Source folder, the Cmake generates many incomprehensible files, but among them there is not one file with the .lib extension.
Help me please.

With CMake you can obtain the visual studio 2017 project files
and then compile the xlnt library.
Unzip the archive file
Within the xlnt folder, create a new directory and call it build
Launche CMake (GUI)
Browse for the source code folder
Browse for the build folder xlnt/build
With the Configure button select the tool (IDE/compiler) that you want to use
Pressing the Generate button, CMake will generate (inside the build folder)
the visual studio 2017 project files you need to compile the xlnt library
Building the solution, VS 2017 produces the xlnt.lib, xlnt.exp and xlnt.dll files.

The source path you see in the CMake screenshot is incorrect. You must specify the path that contains the "top level" CMakeLists.txt file.
The correct directory is: C:/Users/Zver/source/repos/XLNT Library/xlnt-master.
The CMakeLists.txt file in the above directory tells CMake all necessary subdirectories.
At this point you will see the static compilation option of the library appear.
If you use the MinGW/GCC compiler you must prevent the path from containing empty spaces.
Then you need to rename the directory from "XLNT Library" to "XLNTLibrary". At this point the path would become:
C:/Users/Zver/source/repos/XLNTLibrary/xlnt-master.

Related

Problems building XLNT library for Visual Studio 2017

I am having trouble building the XLNT (https://github.com/tfussell/xlnt) library in Visual Studio 2017, and I'm confused. I downloaded the latest version of the library and the latest version of CMake. When I ran the CMake gui, it couldn't find the libstudxml files. A post said that those needed to be downloaded; so I downloaded that library (https://www.codesynthesis.com/projects/libstudxml/#download) and placed it in third-party/libstudxml.
Then I got errors that it couldn't find some .hxx files in libstudxml. I found this article, https://discourse.cmake.org/t/cmake3-20-cant-generate-xint-package/2987, that said I needed to replace libstudxml in some paths in the libstudxml.build\CMakeLists.txt file with just xml. Then it still couldn't find these three .hxx files (content.hxx, exception.hxx, and forward.hxx). I looked in the libstudxml/xml folder (they were all there but extensionless). I changed the CMakeLists.txt file to not have the .hxx extension and Cmake was able to generate.
When I went to compile it in Visual Studio (hitting Project in the Cmake GUI), I got errors that some files couldn't find the content.hxx file again and the builds failed. I'm kind of running in circles. To get cmake to generate, I had to remove the .hxx extensions, but then some files complain because they are looking for them. I tried leaving the three files witout the extensions and removing the extensions from the CMakeLists.txt file, but then some of the files were looking for the files without the extension. Leaving the files both with and without the extension was also a cluster. I understand that C++ can handle extensionless header files, but the CMake file seems to want extension, but I don't think VS is happy with them.
Additionally, while I needed to change the folder name to be xml instead of libstudxml for CMake, various include files in the source code are still looking for libstudxml; so that doesn't work.
Any thoughts?
Thanks--
Al
I experienced the same problems with the same progress and blockages. Indeed changing the extensions or locations did not solve the problem. Then I tried to find another version of the libstudxml library, the creator of xlnt might have used an other one.
So I found the following archive: https://pkg.cppget.org/1/beta/libstudxml/
and placed the files in \xlnt-master\third-party\libstudxml , without modifying the names of the CMake path. This time I was able to compile the library (mingw32-make, I'm not using VS17 in my case).

Compile GLFW Static Libraries in Windows for Visual Studio 2019

Sorry in advance if this is a really simple question or if this has already been answered somewhere. I searched for myself but couldn't find the exact answer to my problem.
I'm following the GLFW documentation to compile the GLFW libraries using CMake. I managed to make the build files, but then the documentation says "Go ahead and compile the actual GLFW library with these files, as you would with any other project."
Unfortunately, IDK how I would compile the library as I would with any other project since I don't see any files I recognize (like .h header files or .cpp files). Instead, I see a bunch of .vcxproj files and a .sln file. I'm unfamiliar with any of these files lol.
So my question is, how would I proceed from here to build a static .lib? Thank you in advance!
Build Output:
Build Directory:
Compiling GLFW Documentation
The build folder will contain a solution file (has a .sln extension) and all the project files (among other generated files) needed to build GLFW. To build you can open the .sln file in Visual Studio and build the Debug and Release configurations directly from the IDE or you can change directory to the build folder and execute this command:
cmake --build .
to build the debug versions of the library or
cmake --build . --config Release
to build the release version.

How to include a library in my code using cmake?

I have tried to ´make´ the library yaml-cpp, not sure I did it right, but how do I build it?
In the tutorial (https://github.com/jbeder/yaml-cpp/blob/master/README.md) it says to run cmake in the build dir, but cmake could not find the cmakelist file, so I did it in the source dir, but then what? How do I build it?
If someone could make a newbie step by step to get the library (or any library really) so I can include it in my code, that would be awesome.
Im using Windows 7, and compiling using terminal (using Codeblocks MinGW gcc/g++) and sublime text 3 editor.
Edit: I have not "make". How can I get this?
Here is the step by step guide:
For the purpose of this answer I will use cmake gui instead to highlight a few key points.
go to https://github.com/jbeder/yaml-cpp and download the root library.
open cmake gui and select the source directory as <my project>/yaml-cpp-master
select a directory for the build. I would call it <my project>/yaml-cpp-master/codeblocks_build
press configure and then check all the values.
press generate and wait for it to complete.
Find the generated codeblocks project file within <my project>/yaml-cpp-master/codeblocks_build
Compile the project as you normally would.
find the generated DLL files and link them to your project.
The reason why you are getting this error is because cmake is trying to find the source code in the directory build which is newly created as seen in the tutorial:
mkdir build
cd build
This is meant to specify to cmake where to build it in rather than where to build from. If you wish to use it via a command line you will need to tell cmake where to build and where the source is.
To then call the functions from that library you will need to link the header files (files that start with .h or .hpp) and the DLL libraries.
the .cpp .c etc is where the implementation is but .h .hpp is where the definitions are.
So when you are including like this: #include<something.h> you are including definitions which are later filled by the .cpp files however in case of a library they are instead filled from .dll or .o

Cannot open source file in visual studio 2015

I am trying to compile OBS studio with this tutorial in windows using Visual Studio Community 2015. I have created a project in visual studio and copied the entire git repo into the project by dragging the files into the solution explorer. This project has dependencies on libav, x264, and curl. They are given as .lib, .dll, and header files.
The problem is I keep getting "cannot open source file". I have the the header files in a separate folder from the dll's and lib's (dll and lib are in the same folder). Under the project settings->VC++ Directories I added the include directory, and also added the library directory. Then I added the lib's specifically under Linker->input->additional Dependencies. Then I added the directory that contains the .dll files to the environment variable PATH.
After all this, I still keep getting the same error, as well as a few other errors. Here is a screen shot of one source file that has the issue.
These are my settings.
For the path, I have tried with and without the trailing forward slash.
EDIT:
Use the C/C++ settings instead of VC++ settings for additional include directories.
What is probably holding you up is that those folder icons in the VS sidebar are not actually related to the file system. They are filters and don't change depending on the actual directory.
This is another explanation for Drop's suggestion -- check to see if the files are really where you think they are.
In my case I already added the include libraries but that was not enough. The error went away once I switched the configuration from x86 to x64 in Project Properties.

Build C++ Projects with Makefile using Visual Studio 2008

I downloaded cpptest from internet, and I want to build it using Visual Studio 2008.
The problem is that instead of .sln and vcproj file, Makefile.am is distributed, and I believe that all the all the necessary included file is included in the Makefile.am.
How to use Makefile.am to generate VS project files? I tried to use Cmake, but there is no CMakeList in the distribution.
Edit: Thanks to all the answers! There is a sln file distributed after all. But I am still interested to know the answer to my original question.
the visual studio project files for cpptest are in the win directory, not in the src directory where the makefile is..
edit
makefiles are meant to be used with GNU make. If you want that on windows, you can look at Mingw, GnuWin32 or Cygwin. But they also require gcc for compiling, so you won't really be using VS.
However, for most projects that do not have external dependencies it's no big deal if you do not have the VS project file: after all a makefile is just a list of the source files and some compilation options. To successfully build projects like cpptest, you could just create an emtpy VS project, add all source files to it, set output type to executable, build it and you're done. Eventually you can tune optimization options, but for the rest the default options will just do fine.
Go to win\VisualStudio.NET and you will find a VS solution file.
I just downloaded the archive and found the .sln file. It is under: /win/VisualStudio.NET. You can open that with VS2008 and update it, it should work.