How to use premake with a vs2017 Qt project? - c++

I have a Qt project with Visual Studio 2017. I tried to generate project files with premake and used the premake5.lua file from this page "https://wiki.qt.io/Premake_Project_Manager". this file uses a qt-support.lua module which is available on github. However, when I build my project with premake it shows the following error "qt-support.lua:707: action "qt" needs a description". Next, I download the example repository that is referenced in the official Qt documentation (https://github.com/annulen/qt-examples-premake) and tried to generate the project files for that. Even with their repository, it shows the same error. I haven’t used premake before and so I might probably be missing something obvious.

Try this one:
https://github.com/dcourtois/premake-qt
I've been using it for years and I'm very happy with it.

Related

VS 2019 keeps finding qrc cpp files as modified even when they are not

I work in a project using Qt compiled with Visual Studio C++ compiler.
I noticed after migrating from VS2017 to VS2019 that when building the application, VS always find qrc cpp files as modified and try to rebuild them.
Is not happening for all projects though, only some unit tests.
Does someone notice this behavior?
I've had the same issues when upgrading from vc141 (2017) to vc142 (2019). It's old but the only post I found, so:
The difference in the toolkits is that in vc142 "Custom Build Tools" are now appended to include inherited values. If your project is configured to use a build tool projectwide by default (for example meta objects from QTs signal/slot), the compiler will try to do that as well when trying to rcc the qrc files, and ultimately failing without throwing an error.
Simply removing ;%(Outputs) in Properties->Custom Build Tool->General->Outputs solved it for me.

Linking SDL 2 VS Code project with Easy C++ Project

I created a fresh project in Visual Studio Code with Easy C++ Project.
I tried to link in SDL2 (downloaded the source from their website), but it feels like I'm missing a step?
IE SDL_Main.h is not found? So I guess it either badly linked or I need to build it? I'm really not familiar with build/make/project setup usually work in V Studio in a already setup project...
Can someone guide me?
after installing the library and setting up the path in properties.json, use
#include
instead of what you used.

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.

Using a DLL with unmanaged code in Visual Studio 2010?

I'm fairly new to C++ and an trying to figure out to use the TagLib library for a project I am working on. I'm working with unmanaged C++ in Visual Studio 2010 on Windows 7 64bit. I've never used an external library before so I'm very confused on how to go about this.
From this blog entry I got the libtaglib.a and taglib.dll files. I ran across this SO question on how to use TagLib, but it deals with QT Creator, not Visual Studio and I'm not knowledgeable enough about the subject to understand what is being said to translate it into what needs done for Visual Studio.
So, some questions:
Is it even possible to do this with unmanaged code?
What exactly is the function of a .a file?
Most importantly, how do I go about using the taglib.dll in my program??
I've been all over Google looking for a way to do this, but my major problem is that everything I run across is over my head. Please let me know if more info is required. Any help is very much appreciated! Thanks!
I seem to have gotten it working successfully. Here's a rough outline of what I did:
1.) I used CMake to generate the Visual Studio solution.
2.) I attempted to build the tag project in the VS solution, but it failed.
3.) I made the corrections to a few source files as outlined here: http://old.nabble.com/taglib-fails-to-compile-with-MS-VC%2B%2B-2010-td29185593.html
4.) I built the tag project again in release mode. This time it was successful.
5.) I copied the resulting dll, def, and lib files to the same directory as the source files for my project.
6.) I copied the header files from the taglib source to a subdirectory in my project (not sure if this entirely good practice)
7.) In my project settings, I set the subdirectory with the header files as an additional include directory.
8.) I added the dll, exp, and lib files to my project by just going to Add>Existing Item.
9.) I added some code from the taglib examples and built it. Everything worked so I think I got it.
One caveat I ran into, since the DLL was built in release mode, my project had to be run in release mode or it would crash. I'm guessing that if I replaced the DLL with one built in debug mode I could run my program in debug mode, but I have not tried this.
You cannot use libraries specific to GCC (you can tell because they have .a extensions) with Visual Studio. You will have to build the library from source in order to use it with MSVC. Once you have done that it's a simple matter of adding the .lib generated from the build process to your project and things should work out of the box. (Note that it's a .lib you need whether you're compiling for dynamic linking or not -- doesn't matter in msvc land)
EDIT -- after looking at TagLib itself --
In order to compile TagLib you'll need to get the CMake build system, and TagLib itself, and have CMake build you a visual studio solution. Using that solution you'll be able to build the .libs and .dlls you need. Note that because TagLib is a KDE library, you'll probably need to also build some QT bits in order for everything work work successfully. However, I don't have specific experience with the library so I'm not going to be all that helpful here.
Yo do not have to recompile the source (to create the .lib file) if you have the .dll file. With dumpbin /exports and lib (both came with Visual Studio) yo can create a lib that you can link with your application. In this link you can see a nice explanation: http://www.coderetard.com/2009/01/21/generate-a-lib-from-a-dll-with-visual-studio/
But as Billy Said, probably you would need other parts of QT to use this library.

How to build wxmathPlot for win32?

I downloaded the latest wxmathplot but the readme is a bit sparse with instructions on how to build on win32 platform.
Has anyone used this library for win32? Can someone point me to the docs or give some hints/advice on how to build for win32 targets.
We'll eventually use this for cross platform stuff, for now it is just win32 until we port our other code.
I presume I have to use CMake, but have not used it before and it is not obvious to me how to build this all - I have already installed CMake, but I am apparently too stupid to figure out how to build this library/samples.
Well, I managed to make an SLN file, but it was not obvious.
I use wxMathPlot. I simply add mathplot.cpp and mathplot.h to the MSVS2008 C++ projects that need to use it. This compiles and links without my having to do anything special.
Here is a partial answer - to get
CMake to build an sln file:
Well, unfortunately there is no good
documentation on how to build
wxMathPlot on Windows, but it is very
simple. Just use CMake:
http://www.cmake.org/
Download and install it, then open
CMake gui, selecting the directory
where you uncompressed wxMathPlot and
a target build directory. click
Configure twice and then click
Generate. CMake does all its magic and
you'll get project files to build
wxMathPlot depending on your compiler.
For example, if you use Visual Studio,
a solution sln file is generated: open
it and build.
That works for building an sln file