PietCreator C++ won't compile - c++

I'm trying to compile PietCreator using CMake, but I get various error codes. How can I fix this?
Error codes:
Compiling the C compiler identification source file "CMakeCCompilerId.c"failed.
Compiler:
Build flags:
Id flags:
The output was:
The system can not find the file specified
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:
The output was:
The system can not find the file specified
Here is source: https://github.com/Ramblurr/PietCreator
Compiling with CMake 3.3.0 and Visual Studio 14 2015 Win64 on Windows 8.1 64x

When building project files with CMake, you have to make sure to install all dependencies and (usually) use the compiler suggested in the docs of whatever source code you are building project files for. In this case, you'll need Qt 4.x installed, along with the Visual C++ 2008 compiler. After doing that, you should be able to tell CMake to use that version compiler, set the QT 4.x directory in the main window of the GUI (or by command line), and have your .sln file created.

Related

Building WinUI 3 Desktop Application using MSBuild with Visual Studio LLVM clang-cl

This question is an extension of the earlier question I had asked here.
Hi, When I create a WinUI project in Visual Studio, below is how the project structure looks like:
This project by default gets built using MSBuild as build system and default MSVS compiler.
However, I would like to build this project using MSBuild as build system and LLVM toolset for compilation and linking.
Is this possible to achieve?
This is how I am trying.
Installed clang-cl via VS load
Generated CMake cache using CMake like below:
cmake -G "Visual Studio 17 2022" -T ClangCl D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master>cmake -S . -G "Visual Studio 17 2022" -T ClangCL
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
-- The C compiler identification is Clang 15.0.1 with MSVC-like command-line
-- The CXX compiler identification is Clang 15.0.1 with MSVC-like command-line
And this automatically picks VS's LLVM's clang-cl.exe as compiler
But when I build like below, it fails.
D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master>cmake --build .
It fails with below error:
D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src/App.xaml.h(4,10):
fatal error : 'App.xaml.g.h' file not found [D:\Wi
nUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\DemoApp.vcxproj]
D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\MainWindow.xaml.cpp(9,3):
error : use of undeclared identifier 'Initi alizeComponent'
[D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\DemoApp.vcxproj]
D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\MainWindow.xaml.cpp(15,12):
error : function 'IsSettingsInvoked' with deduced return type cannot
be used before it is defined
[D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\DemoApp.vcx
proj]
It seems MSBuild process did not generate App.xaml.g.h/App.xaml.g.xpp (and many more files that gets generated if we use MSVC Compiler )) which means that MSBuild did not run the xamlCompiler task to generate all the .g.h and g.cpp files.
Is there anything specific need to be done to resolve this issue? Am I missing something here?
Any pointers/suggestions will help.

No CMAKE_Fortran_COMPILER could be found

I am using CMake for my c++ and Fortran projects. I use the Intel Fortran compiler and VS2017. Every time I try to configure the project in the CMake-gui I get this error:
The Fortran compiler identification is unknown
CMake Error at Lib/Fast_Table/CMakeLists.txt:2 (project):
No CMAKE_Fortran_COMPILER could be found.
I have looked all over the internet for the solution and I can't seem to find any solution for my problem. The Paths all seem correct and match other peers with the same project.
Here are the errors that show up in the CMakeError.log file:
Compiling the Fortran compiler identification source file "CMakeFortranCompilerId.F" failed.
Package 'IFLangServicePackage' failed to load.
LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
The .F file in the error above compiles on it's own and so do other VS2017 Fortran projects I have tried to build in VS2017. It's the configuration and generation process in the cmake-gui that is giving these errors.
My installations of VS2017 and Intel Fortran were not setting up correctly. I had to go to the Intel Fortran solution in my build directory under .\CMakeFiles\3.18.4\CompilerIdFortran. I opened the project in Visual Studio. Tools >> Options >> Intel Compilers and Tools >> Visual Fortran >> Compilers. Then I went to the x64 tab and instead of having "Latest" selected, I selected "Intel(R) Visual Fortran Compiler 19.1.0.166 [Intel(R) 64]" and this had the proper setup for compiling Fortran. There were also some files in the 2020 compilers_and_libraries dir that were not in the 2020.0.166 dir.

CMake: How to specify VS2015.3 toolset with VS2017 installed

I have VS2017 installed, with both VS2017 (v141) and VS2015.3 (v140) toolset installed. I need to generate a solution with CMake and I want CMake to be "fooled" as if VS2015 is installed, so I can build the project with v140 toolset.
I know this question is possibly a duplicate of:
How cmake specify "Platform Toolset" for a Visual Studio 2015 project?
But the solution it provides doesn't help me.
The error messages are:
Selecting Windows SDK version 10.0.14393.0 to target Windows 10.0.15063.
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:18 (project):
No CMAKE_C_COMPILER could be found.
I tried installing both VS2017 and VS2015.3 (IDE), but VS2015.3 refused to create even a simple console program.
Is there another way to generate a solution with v140 toolset?
(P.S. Don't tell me that I should generate with v141 toolset first and modify the toolset option in Visual Studio. That makes a big difference. )
I've just ran a test and it works for me with the following settings in CMake's GUI (Version 3.10.0 RC4):
Then I get the following output:
The CXX compiler identification is MSVC 19.0.24215.1
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Configuring done
Generating done
And if I open the resulting solution it will - as expected - ask me:
Platform Toolset Mapping
From Marco Foco: Microsoft Visual C++ version Map:
If that don't work ...
First please check the CMakeError.log in your binary output directory. The error should give you a lead on what's wrong.
If that's not helping, you can try several things (besides re-installing VS, which I think won't solve the problem):
One of the Windows SDKs is not fully/correclty installed; Reinstall from Microsoft's web site
Try to give the cmake-gui administrative rights
Check if there is a GNU toolchain with GCC compiler in your PATH environment.
References
VS 2010 and CMake: 'rc' is not recognized as an internal or external command
MSBuild.exe has stopped cmake error
Environment variable used by CMake to detect Visual C++ compiler tools for Ninja

Compile CMake based project with minGW

I want to use SignalR in a Windows project that is compiled with MinGW (MSYS2). As far as I know I cannot link against a library (dll) compiled with another compiler (i.e. VC++).
Hence, I need to compile SignalR with MinGW.
Here the repository:
https://github.com/aspnet/SignalR-Client-Cpp
The project is based on CMake rather than a standard Makefile.
This is what I did:
downloaded CMake: https://cmake.org/files/v3.8/cmake-3.8.0-win32-x86.zip
extracted to a folder (i.e. C:/dev)
exported the cmake/bin folder to the PATH var (in /etc/profile)
checked if it works :) with cmake --version
cloned the Cpp Rest SDK (https://github.com/Microsoft/cpprestsdk.git)
Trying to compile the Cpp Rest SDK as described here:
https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux
leads to this output:
$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.10.25019.0
-- The CXX compiler identification is MSVC 19.10.25019.0
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe
-- works
I'm afraid it's still using the MSVC compiler so the output binaries won't be compatible with my application.
How should I compile those libraries?
CMake does not build anything itself. Rather it generates the configuration files for make, MSBuild, Ninja, etc. Each platform has its default generator. For Windows, that is Visual Studio/NMake.
You can select a generator manually with CMake’s -G option. Some generator names contain spaces. Make sure to put quotes around those.
I am not familiar with the mingw tool chain but in cygwin it includes its own build of cmake for which you would use to generate the build system for your library. You are using the pre-compiled Windows binary which is going to detect Visual Studio.
If mingw doesnt include a prebuilt cmake I would download the source and compile it within mingw and then use that cmake binary to generate the build system of SignalR.
Download from: http://www.cmake.org/download/
And build it by:
./bootstrap
make
make install

CMake : C and CXX compiler identification is unknown Win10 CMakeGUI

So I am trying to configure a file based on this tutorial on youtube which is very simple :
https://www.youtube.com/watch?v=gYmgbqGfv-8
I use CMake GUI in Windows 10 and I have a running Visual Studio 2015 which is able to build c++ projects already (I've used it for some time)
I use "Visual Studio 15 2017"
I created a folder named hellocmake and hellocmake/build for both inputs:
my inputs
However when I tried to configure, it says that
CMake Error at CMakeLists.txt:1 (PROJECT):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:1 (PROJECT):
No CMAKE_CXX_COMPILER could be found.
The error log specifies that it can't find the two compiler files :
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:
The output was:
The system cannot find the file specified
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:
The output was:
The system cannot find the file specified
I tried downloading the "CMakeCXXCompilerId.cpp" and "CMakeCXXCompilerId.c" files and try to add them manually in the same folder, but it doesnt solve it
I tried to look up several other sources which have a similar case but I can't seem to understand them.
This problem didn't exist with my old computer so I assume it has something to do with the Visual Studio ?
Thank you guys, any help will be appreciated
You selected Visual Studio 2017 which you don't have installed. I think you confused the actual version number (which is 15 for VS2017) for the year in which the version was released. Pick a VS2015 generator (version number 14) and it should work.
I agree with #rubenvb's answer, add a tip: before you execute change "15" to "14", you should remove the "CMakeCache.txt" file.
cmake -G