CMake: "The C compiler identification is unknown" in Windows SDK - cmake

This is the first time I've come across CMake. When I follow CMake instructions to extract a C# project, it give the below error.
Selecting Windows SDK version to target Windows 10.0.15063.
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
No CMAKE_C_COMPILER could be found.
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
I tried to fix the error by googling, but not able to find the problem yet. Can someone please help me.
Note:
I am running CMake on a Windows 10 computer, that has Windows 8.1 SDK, Visual studio 2015, 2017 installed.

I was having the same issue with a very similar system configuration. In my case, it appears to have been related to this question which pointed me to this bug report.
So the fix (for me) was to update CMake:
Uninstall your current version of CMake.
If you installed it using an installer script, you'll need to run the uninstaller as noted on CMake.org.
Installer tool has changed. Uninstall CMake 3.4 or lower first!
If you installed a zipped portable version, you can simply delete it and/or move it out of your PATH environment variable.
Download the latest CMake (at time of writing, 3.14.5). This time I opted to install the zipped version and manually add it to my PATH environment variable since I only ever use CMake from command prompt anyway, but you're welcome to use the MSI instead.
And after that everything worked fine! Hope this helps.

Related

Cmake configuration error, CMAKE_CONFIGURATION_TYPES Debug;Release;MinSizeRel;RelWithDebInfo

I am using windows 10 and have followed classic installation using the latest git bash inside the folder I want using option(1) copying the git text to the git bash and the cloning went normal no errors, I have also downloaded the latest CMake x64 version and followed the guide exactly and after I choose vs 15(2017) and hit finish I have an error message saying error in the configuration process, "project files may be invalid"
I already had git and CMake and all versions of vs installed but to make sure I redownloaded the newest versions and tried again no luck, I also recloned the repository no luck. after the error pops up there is a list item in CMake with name:CMAKE_CONFIGURATION_TYPES value:Debug;Release;MinSizeRel;RelWithDebInfo
Any help appreciated, if I figure it out I will update this thanks.
I found the issue, the pathing to my visual studio 15 2017 was incorrect, thanks peeps.

How to configure cmake for msys2

I'm using external cmake with msys2, since cmake-gui provided by msys2 won't run (invalid win32 application). Now the problem is there's only so much I can configure using cmake-gui. I downloaded OpenALSoft today and when I ran make install it installed to C:\Program Files (x86)\. How do I configure external cmake to install into mingw32 or mingw64 depending on what's running? On top of that, I'm having a problem differentiating between PATH RPATH and PREFIX (and how those correspond to msys2 install structure), so if you could, please, clarify those too, I'd really appreciate that.
I always use this invocation to make sure the install directory is set to /mingw32 or /mingw64:
MSYS2_ARG_CONV_EXCL=- cmake . -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX
And then when you want to install the built project, you must do this:
make install DESTDIR=/
All of this trickiness is due to the fact that CMake is a native Windows program that does not understand MSYS2-style paths like /, and MSYS2 has some automatic conversions of paths that happen when it detects you are running a native Windows program like CMake.
By the way, MSYS2's cmake-gui works for me, so maybe you should try reinstalling the CMake package in MSYS2 or something. However, I expect my answer to work for both the external CMake and the one in MSYS2.

CMake not able to find Qt4

I'm working on a project using PCL (point cloud library) for which I need to configure some code files using CMake. But some of these files aren't getting configured and the error CMake shows for those files is "Qt4 not found". I already have Qt 4.8 installed and this is the only Qt version I have. Also, for some of the other files, CMake used Qt without showing any error. And when I run qmake.exe, it shows "Qt : Untested windows version 6.2 detected". And for all the Qt5 related entries, CMake shows "NOT FOUND". Have I installed the correct version of Qt? And how can I get CMake to detect Qt4?
I'm using windows 8.1 64bit
When I typed qmake -v in command prompt, I got this -
Qt: Untested Windows version 6.2 detected!
QMake version 2.01a
Using Qt version 4.8.0 in C:\Qt\4.8.0\lib
cmake to find Qt users qmake, so if you run it not from command line,
make sure that global environment variable PATH set to proper value, so cmake can find qmake
cmake cache libraries search results, bad results also. Because of that, if it can find some library, you install it, then rerun cmake it can show again "library not found" message, even if your setup is corrret. So make sure to remove CMakeCache.txt before rerun cmake.

Migration from wxWidgets 2.8.12 to wxWidgets 3.0.2 - features.h

I have recently migrated my project from wxWidgets 2.8.12 to 3.0.2. I am using Eclipse as my IDE under Windows 7 OS. The GCC version is 4.6.2.
I have successfully compiled debug and release versions of wxWidgets 3.0.2 and integrated to Eclipse. I compiled my project and I got the error in features.h file saying missing ")". When I read the purpose of features.h, to my understanding it was meant for compatibility with previous versions of wxWidgets so I have deleted everything in features.h and then compiled my project and now it compiles with no errors and everything in my project functions fine when I run the binary.
By the way, I had the same problem with TDM compilers as well. I have also rebuild the index of Eclipse in case there were remnants from wxWidgets 2.8.12 which could confuse the compiler but the problem with features.h remained there until I deleted everything in features.h.
My question is: By deleting the features.h, am I going to run into a problem in the future or will wxWidgets function normally?
Best regards,
Don't do that.
Find out where the real problem lies. There are a lot of people that successfully build wxW with gcc.
The best and easiest test is to build wxW, then build 'minimal' sample. Any error when doing that?
features.h is there for a purpose; by deleting its contents, the symbols there may become wrongly [un-]defined. Further more, if you have deleted contents of features.h after you had compiled wxW but before compiling your project, then that is a completely wrong build.

Troubling Compiling wxWidgets with MinGW

I am having trouble compiling wxwidgets with mingw on Windows 7 x64. It compiles for 30+ min, then runs out of memory. My computer has 6 GB of memory, so I don't know what is wrong.
Someone mentioned something about a 64 bit version of MinGW. Would this help, and if so, how would I use this?
I am able to compile just fine with Visual Studio.
Also, if I wish to use it with CodeBlocks, how do I add wxWidgets to CodeBlocks (I.e. link to it)?
Actually, I somehow solved my own problem a few days ago, but forgot to note this up here.
I deleted the wxWidgets folder, reinstalled it, then compiled it according to the directions in a zip file here: http://dev.arqendra.net/#cbnb.
After you have installed wxWidgets, fire up msys, cd to the wxwidgets folder, then run
mingw32-make -f makefile.gcc BUILD=debug UNICODE=1
(Assuming mingw32-make is in your path).
Wait a while (maybe 20 minutes, depending on your computer's processing power).
Repeat this for release i.e.:
mingw32-make -f makefile.gcc BUILD=release UNICODE=1
Next, you have to deal with a quirk by copying \wxWidgets\include\wx\msw\setup.h to \wxWidgets\include\wx.
You can apply other options to your liking.
Also, to "add" wxWidgets to a project in C::B, you can just set up a wxWidgets project, saving you the trouble of adding the right directories (and .a libraries).
I used MinGW 4.5, installed using the "MinGW GCC 4.5.0 Installer" from their site. To compile wxWidgets using MinGW, I used:
cd %WXDIR%\build\msw
mingw32-make -f makefile.gcc BUILD=debug RUNTIME_LIBS=static
In codeblocks there is a dialog for setting the path for MinGW. You set the path for wxWidgets in the new app wizard. I really recommend you set the same MinGW version you used to compile wxWidgets.
This is probably due to this gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601#c9 you may try installing another version of gcc.