# The C compiler is not able to compile a simple test program

**URL:** https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177
**Category:** Usage
**Tags:** os:windows
**Created:** [April 20, 2021, 2:47pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177 "2021-04-20T14:47:51Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Abdo\_Ameen](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdo_ameen/32/1398_2.png) [@Abdo\_Ameen](https://discourse.cmake.org/u/Abdo_Ameen)
#### Post date: [April 20, 2021, 2:47pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/1 "2021-04-20T14:47:51Z")

</div>

Hello,  
Hello, I’m trying to install Gazebo on my Windows 10 machine and I’m following the official tutorial ([Gazebo : Tutorial : Windows](http://gazebosim.org/tutorials?tut=install_on_windows&cat=install)). When I try to configure and build the dependencies using CMake I get the following error:

 ![image](https://discourse.cmake.org/uploads/default/original/2X/5/57903a09dbd876df0481004eb19a5133140f5d54.jpeg)

Any idea on how to fix this problem?  
Many thanks in advance.

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [April 20, 2021, 2:53pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/2 "2021-04-20T14:53:47Z")

</div>

It seems you have mixed toolchains somehow - the compiler chosen in `cl.exe` (MSVC toolchain), but it’s trying to link by `ld.exe` (GNU toolchain).

---

<div class="post-metadata">

### Author: ![Abdo\_Ameen](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdo_ameen/32/1398_2.png) [@Abdo\_Ameen](https://discourse.cmake.org/u/Abdo_Ameen)
#### Post date: [April 20, 2021, 4:06pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/4 "2021-04-20T16:06:40Z")

</div>

Thank you for the hint. Can you please explain how to use the right toolchain? So what is the next step? I’m not a software developer and this is my first encounter with CMake.

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [April 20, 2021, 8:32pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/5 "2021-04-20T20:32:49Z")

</div>

I realize it’s not ideal but try using the meson instructions. At least for setting up your toolchain environment.

Use this for setting up your compilers/linkers. Ignore everything else regarding meson.  
[https://mesonbuild.com/SimpleStart.html](https://mesonbuild.com/SimpleStart.html)

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [April 20, 2021, 8:34pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/6 "2021-04-20T20:34:33Z")

</div>

In particular try using the pre-baked command prompts visual studio provides. Instead of you trying to use the .bat file.

IE: Try invoking your project from a vs command prompt:

![image](https://discourse.cmake.org/uploads/default/original/2X/5/51c5dc7bc942367d9950121cb167f4c2927df08f.png)

Just use cmd prompt. Then try using cmake like normal.

---

<div class="post-metadata">

### Author: ![Abdo\_Ameen](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdo_ameen/32/1398_2.png) [@Abdo\_Ameen](https://discourse.cmake.org/u/Abdo_Ameen)
#### Post date: [April 21, 2021, 12:04pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/7 "2021-04-21T12:04:48Z")

</div>

Thank you. I already have VS 2019 with Desktop Development with C++. Then I installed meson. Now should I build the project using meson? The file I’m trying to run is called (.\configure), should I build a project to run it?  
Frankly it still does not make sense to me.

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [April 21, 2021, 6:02pm UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/8 "2021-04-21T18:02:06Z")

</div>

I believe I have confused you further the point was not to install meson. Just to make sure you already had setup the proper toolchain environment. Don’t install meson.

Uninstall meson. That’s not gonna help you here.

I’m not really familiar with NMake. Is there any reason you can’t use Visual Studio / Ninja as your generator instead?

---

<div class="post-metadata">

### Author: ![Abdo\_Ameen](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdo_ameen/32/1398_2.png) [@Abdo\_Ameen](https://discourse.cmake.org/u/Abdo_Ameen)
#### Post date: [April 22, 2021, 11:49am UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177/9 "2021-04-22T11:49:44Z")

</div>

someone on Github suggested that it is a DLL Hell ([DLL Hell - Wikipedia](https://en.wikipedia.org/wiki/DLL_Hell)) because my system is not cleaned or formatted for a long time, and that’s true. I installed Gazebo in another way, namely by installing ROS, and I got Gazebo included by default. So I got the software I need but didn’t fix the issue in CMake. That is fine for the mean time.  
Thank you for your help and care @YMba9g8j9CJp0wLoQf5y 🙏 🌷
