Building Gtk app for Windows OS - msys2 mingw vs Visual C++ - windows

Are there any advantages for building a Gtk3 app for Windows OS with the MSVC Visual C++ Compiler over msys2 mingw (ucrt64)?
Functionality-wise? Look-wise? Debug-wise?, Deployment-wise?
I'm new in a project that builds Gtk2 apps for Windows with Visual C++. No one really remembers if there was a special reason for using Visual C++.
I was asked to create a build process for the Gtk3 version.
I came up with using Mingw (ucrt64) with msys2 which is one of the ways described on Gtk Windows page.
Packaging and Build:
I installed the necessary packages with msys2 and I'm able to build the app both with mingw and with Visual C++. With mingw I can use pkgconfig with cmake. With Visual C++ It's not so straight forward - I just give it hard-coded paths.
Debug:
When building with mingw I was able to also debug with gdb (also by using VS code). I haven't tried to debug the Visual C++ build yet.
Deployment:
After the Mingw build I created some shell script to copy dlls, icons, etc.. to a release dir and I can package this this and deliver it. Is there a better way with Visual C++?

Related

Qt on windows with mingw and no MSVC redistributable?

Qt supports compiling all including qml without MSVC. So how to install qt creator and qt studio without them, how to create qt package that will not rely on MSVC at all?
You could build QtCreator with mingw and distribute it in your classroom : take a look at the Readme https://github.com/qt-creator/qt-creator
If you cannot install MSVC redistributable run times, you can either build your own package using MinGW (see other answers, but note that you only need to rebuild Qt Creator and Qt 3D Studio, not Qt intself).
Or you can install the official packages that do depends on MSVC runtimes (for QtCreator and Qt Studio) and instead of installing the MSVC Redistributable Package, you can copy paste the required DLLs to the installation folder (e.g C:\Qt\Tools\QtCreator\bin for Qt Creator).
For Qt Creator it seems that you will need:
MSVCP140.DLL
VCRUNTIME140.DLL
You can check the missing DLLs using Dependency Walker or similar tools.
Note that if copying the DLLs around is not recommended by Microsoft, but it does work. And it is less cumbersome that rebuilding Qt Creator.
It's also possible to directly install redistributable Visual C++ DLLs
in the application local folder, which is the folder that contains
your executable application file. For servicing reasons, we do not
recommend that you use this installation location.
https://learn.microsoft.com/en-us/cpp/ide/redistributing-visual-cpp-files

Qt 5.3 configuration error for VisualStudio 2010

I am relatively new to the Qt. At the moment I'm trying to configure Qt library for my machine before installing add-in for VisualStudio'10. I tried to download Qt library only (withouth a Qt creator IDE), and found "qt-everywhere-opensource-src-5.3.2.zip" and extracted it to my external drive: "F:\Programs\Qt\5.3.2". Then I run command "configure" on VisualStudio command prompt.
F:\Programs\VStudio'10\VC>cd F:\Programs\Qt\5.3.2
F:\Programs\Qt\5.3.2>configure
After a while it gave me following error:
Running configuration tests...
NMAKE : fatal error U1077: 'F:\Programs\VStudio'10\VC\BIN\link.EXE' : return cod
e '0x463'
Stop.
Could not find output file: No such file or directory
WARNING: The DirectX SDK could not be detected:
There is no Direct X SDK installed or the environment variable "DXSDK_DIR" is
not set.
Disabling the ANGLE backend.
WARNING: Using OpenGL ES 2.0 without ANGLE.
Specify -opengl desktop to use Open GL.
The build will most likely fail.
On the installation instruction that was found on Qt webpage, it was said to set environmental variables: "Add this 2 paths to the Environment Variables: “C:\Qt\2009.01\bin” and
“C:\Qt\2009.01\qt\bin”." But I was unable to find any "bin" directory in my qt-everywhere folder. Instead I set up following variable to my path: "F:\Programs\Qt\5.3.2\Qtbase\bin". Still no help.
How can I resolve these issues? Any ideas and help are highly appreciated.
What you've done is more like attempting to prepare building Qt itself from the source code (but that is not exactly how to do that, anyway). You don't need that at least now but when you start customize Qt framework, say, for static build. That is when configure tool comes handy. And you will need to read on that.
You need just to download its installer from: http://qt-project.org/downloads
I assume you don't have prebuilt Qt and Qt Creator in your system but that is prerequisite for what you want to do. Take either Community version or start download immediately. After you've installed certain Qt version for your platform including Qt Creator (which is native Qt IDE) you will also be able to install and use Visual Studio AddIn. And then take Visual Studio AddIn for Qt 5 from: http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe and install it. Read the instruction on how to use it. There will be some new menu for importing Qt project, though.
BTW, Qt Creator itself is not bad at all and maybe preferable for most of Qt development tasks except some debugging. I maintain entire project in Qt Creator and write the code there and only occasionally go to Visual Studio with AddIn installed to import Qt project there for some better debug experience.
you can try run "configure -opengl"
or , you can download Microsoft DirectX SDK and install it ,then try again.
http://www.microsoft.com/en-us/download/details.aspx?id=6812

Where is llvm-config in Windows?

I am open to either a Visual Studio answer or a MinGW answer. I just finished building LLVM 3.2 using CMake and Visual Studio 2010. Everything went smoothly, but I have no llvm-config. Do I need it? Every example I see on the intertubes makes use of that tool. If I don't need it, how do I configure my project to make use of LLVM?
To be clear, I am not trying to use LLVM tools/compilers (like clang and whatnot). I am trying to write C++ code that uses the LLVM libraries to produce LLVM IR and even compile that stuff. I setup my include and lib folders. I ran llvm-config in Linux and saw a long list of macros and libraries.
I have a wonderful folder full of goodies. It just has no llvm-config in there: C:\Program Files (x86)\LLVM\
llvm-config does not exist in windows prebuilt binaries. You need to compile from the source code to get it.
Grab CMAKE > 3.5 , install it and make sure you add it to PATH.
Download Visual Studio 2019
Donwload the source code (9.0.1 is the latest as I'm writing this)
Extract the source code
Cd into the root of the llvm source-code
In cmd, type cmake . this will generate Visual Studio 2019 sln.
open sln file(LLVM.sln), change the build type to Rlease, build the whole project
navigate to your Rlease\bin, and there you have your llvm-config.exe
If you have built the LLVM in debug version all the executables (including llvm-config) have been placed in your build directory (containing Visual Studio project and solution files) in bin/Debug/ subdirectory. In case of release build replace Debug with Release.
If you are interested in using LLVM on Windows more than building it, check out Windows snapshot builds.

Compile CUDA without Visual Studio - "Cannot find compiler cl.exe in path"

I've just begun a small project in CUDA.
I need to know the following:
Is it possible to compile CUDA code without using/buying Microsoft Visual Studio?
Using Nvcc.exe I get the error "Cannot find compiler cl.exe in path".
I've tried to install a CUDA plugin for NetBeans, but it doesn't work. (with current version of NetBeans)
Platform: Windows 7
Thanks in advance.
Update
As noted in the comments, versions of the SDK after Windows 7's do not include the build tools. If you want to use Microsoft's most recent tools you have to install Visual Studio. Once installed, you can use the tools from the command-line.
At the moment the free versions are the "Community" versions, e.g. Microsoft Visual Studio Community 2015.
You can continue to develop apps for Windows 7 and earlier (and they will run on later versions of Windows) using the old SDK tools as I described before:
Original Answer
If you desperately want to avoid Visual Studio, download and install the Windows SDK. This contains (more or less) the same build tools as Visual Studio.
Then run the Windows SDK Command Prompt (which you'll find on the start menu under Microsoft Windows SDK) to set the path to point to the tools, and you are set.
Or just use Visual C++ Express.
Following the previous comments I've installed Studio Express & VS2010.
This did not solve the "cl.exe not in path" problem.
I solved the problem with the error Cannot find compiler cl.exe in path, by including
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 in PATH,
before installing Windows SDK.
This question also contains valuable information.
For some reason VS2010 & Studio Express failed to set the proper variables in path even after the execution of vsvars32.bat.
Thank you all for your valuable help.
add this options to nvcc
nvcc x.cu <other options> -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"
i use VS2012 and my cl.exe dir is here.
You have to figure out where NVIDIA GPU Computing Toolkit is installed.
In my system it's in "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" Then
"Edit Environment Variables" on Windows.
Click on New...
Variable name: NVCC
Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe
Click on OK.
Use windows subsystem for linux and install ubuntu and nvcc along with gcc and g++ using the ubuntu terminal in windows (gui does not works for linux subsystem for windows). Then configure .bashrc using bash and vim/nano with a 'cd' command to your desired location as it is done in usual linux terminal (makes it easy as bash opens in system32 folder everytime). And then you can compile .cu files using nvcc over bash. As nvcc supports gcc and g++ under linux so it solves the problem. No need to sacrifice peace for switching over to linux or dealing with crappy visual studio. It worked for me.

Using both mingw and msvc under QtCreator

I want to make QtCreator able to compile with mingw and msvc but i don't know how.
I found some information over the internet but didn't work for me.
I tried by installing
QtSDK + qtvs2008 + qt visual studio addin [FAIL]
QtCreator standalone + mingw + qtvs2008 + qt visual studio addin [FAIL]
QtCreator compiled with visual studio + mingw + qtvs2008 [FAIL]
I don't know what else to try so i will need some help here.
Is this thing possible?
I have vs2008 installed. When I download the latest Qt version and create project in Qt Creator it automatically adds targets for mingw and msvc. In other words, when you install Qt SDK select "custom" install and check what components you are installing. Addons for vs2008 is included in the package.
Start with the Qt SDK. That gives you Qt Creator, the MinGW compiler, and a Qt version compiled with MinGW, and is suitable for developement with MinGW out-of-the-box. Then add a stand-alone version of Qt binaries build with MSVC, or get the sources and compile it yourself (configure.exe and nmake from a MSVC command prompt). In Creator you go to Tools->Options->Qt4 Version, and 'Add' the MSVC version by pointing the entry to the bin\qmake.exe in the MSVC version. Afterwards you should be able to switch between the MinGW and MSVC version in the Project tab. You don't need the Visual Studio AddIn.
While installing, choose custom type of installation. Selecte libraries for needed compilers in QtSDK->Development Tools->Desktop Qt->Qt-.
4/1/2016
I think maybe you need this qt online_installers. With this way, maybe you can make qt-mingw and qt-msvc work together.
Here are the configure screenshot:

Resources