How to use a .a generated from MinGW in VS? - include

I´ve been searching with no success. Can I use the lib and include files generated using Msys in Visual Studio? If its possible, how? I have these programs I need to use in a GUI created in Visual Studio. I´ve already done this in Linux but I´m having problems trying to do the same but in Windows.

Yes, you can by simply adding that *.a file to the link libraries, but I do not recommend doing so. You will very likely run into linker errors.
The better way is to generate a *.dll and an import library and then link against the import library.

Related

Compiling a static program in Visual Studio (VCPKG / CMAKE)

I am trying to create static program in Visual Studio, where I end up with a single executable that I can deploy to other PCs.
I am using VCPKG to static download libraries, as per the instructions here:
https://devblogs.microsoft.com/cppblog/vcpkg-updates-static-linking-is-now-available/
In the following post, the answer to the question is to use VCPKG and then CMAKE
Using Cmake to build ssh.dll with Visual Studio 2017
My question is with regards Cmake. If VCPKG downloads and creates folders that my project links to. What's Cmake for and why would I need to use it?
What's Cmake for and why would I need to use it?
https://cmake.org/ read the text below the logo.
It can be used to generate a project files for different build system, like make, msbuild, ninja etc.
It also can be used as a general scripting language.
You don't need to use it but it is highly encouraged for consuming other dependencies.
vcpkg however will download cmake since it is used as a scripting language within vcpkg.

How do i include RVO2 library in Visual Studio?

I have been writing a code which uses SDL to render particles in Visual Studio. However, there does not seem to be any way to include RVO2 library:
http://gamma.cs.unc.edu/RVO2/downloads/ to Visual Studio. I have been able to include header files, but library file seems to be libRVO.a which Visual Studio is maybe not accepting. Also, there is no .dll file as was with SDL2 download.
So, I wanted to ask is there any way in which I can use RVO library in Visual Studio.
If not, I have another similar question...
I am using wsl(Windows Subsystem for Linux) and found that SDL cannot be run in it. I am able include RVO in wsl. So, can you suggest me a way where I can use both the libraries RVO and SDL2 simultaneously...

LLVM: How to get up and running and use files in include/llvm/?

I've downloaded the binary for Windows (here: http://llvm.org/builds/), but this doesn't include any of the files, e.g., "llvm/IRReader/IRReader.h", that many tutorials use.
Now, I've downloaded the LLVM source (here: http://releases.llvm.org/download.html), but instructing Visual Studio to look up include files in "include/llvm" results in lots of errors: header files cannot be opened, because they have a cmake suffix.
How do I get up and running fast without too much configuration?
You will need to run CMake before you can do anything. That will create Visual Studio solution files, which you can then use the build the LLVM binary files from sources. Only after you have build the binary files, you will be able to develop further applications linking to LLVM.
There is a platform independent guide here, also there used to be a windows specific guide too, which I could look for later.
http://llvm.org/docs/CMake.html
For a first-time user of CMake I would recommend CMake-GUI, as it is much less of a hassle to use.
I think for starters one can use default settings. Just make sure to select the correct Version of Visual Studio, otherwise you might end up with incompatible solution files

Linking DLL in Visual Studio 2010 C++

I am trying to use the M4RI package for C++. I downloaded the source for M4RI and ran the packaged VS project. It created m4ri.dll (no .lib files).
Now I want to "add" this dll file to a different VS2010 C++ project so I can use the M4RI library.
I already #include m4ri.h, but still get linking errors. How do I add this reference to the VS project?
Thanks in advance.
My solution:
I am not familiar with the differences between C and C++, but this seems to be the issue. To get the M4RI library to build, I had to explicitly tell it to compile with C++ (Properties->C/C++->Advanced->Compile As: "Compile as C++")
I'm not sure if this caused my problem, or if it is unrelated.
To be able to use the library, I had to modify "m4ri.h" to remove the #ifdef __cplusplus sections. As soon as those precompiler directives were removed, I was able to link to M4RI easily.
I would appreciate if someone could explain why this fixed the problem.
Thanks!
Linking errors can come from many things. Are your link errors related to m4ri? With dlls, you usually get a an export lib which should be included in your project.

Generating redistributable Visual Studio project with cmake

is it possible to generate Visual Studio projects that are redistributable with CMake?
The project file in question are examples/demos of our library. We don't want that our customers have to install cmake (and learn what to do with it) just to compile a few examples.
The problem with CMake generated project files is that they contain absolute paths (relativeliy easy to fix with string replacement) and references to CMake files (e.g. in prelin step. This is not easy to automatically change).
Does CMake provide an easy way to solve this problem?
Thank in advance
Yes,
you can have a cMake project, and generate Visual project on windows, XCode or makefile for other plateforms.
You use it for development, and after use install package makers like iceberg on mac, or scripts based installers on linux, or other installer creator on PC.(inno setup I think could be a solution)
Good luck

Resources