# GCC: Skipping incompatible (ERROR)

**URL:** <https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472>\
**Category:** Code\
**Tags:** os:windows, gen:ninja\
**Created:** [March 25, 2024, 11:03am UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472 "2024-03-25T11:03:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto](https://discourse.cmake.org/user_avatar/discourse.cmake.org/roberto/32/4435_2.png) [@Roberto](https://discourse.cmake.org/u/Roberto)\
**Post date:** [March 25, 2024, 11:03am UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472/1 "2024-03-25T11:03:08Z")

</div>

Good morning,

I switched my IDE and applied the required additional include & preprocessor definitions into the CMakeLists.txt file, but encounter errors when trying to BUILD the project (x86 / Release).

The binary consists of multiple .cpp files and should be linked with the STATIC curl library(x86), which is installed in the /dependencies/curl directory.

CMakeLists.txt:

```auto
cmake_minimum_required(VERSION 3.24.0)
project(recorder)

set(CMAKE_CXX_STANDARD 20)
set (CMAKE_CXX_FLAGS "-fpermissive -m32")

# Set flags to build 32-bit binary & which exe to use for C / C++
set(CMAKE_C_COMPILER gcc)
set(CMAKE_C_FLAGS -m32)
set(CMAKE_CXX_COMPILER g++)

# Define project
file(GLOB_RECURSE MY_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_executable(${PROJECT_NAME} "${MY_SOURCES}")

# Preprocessor definitions
target_compile_definitions(${PROJECT_NAME} PUBLIC WIN32 NDEBUG _CONSOLE CURL_STATICLIB UNICODE _UNICODE)

# Include directories
include_directories(${PROJECT_NAME}
    PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
    PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/curl/include")

# Add libcurl library
add_library(curl STATIC "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/curl/lib/libcurl_a.lib")
set_target_properties(curl PROPERTIES LINKER_LANGUAGE C)

# Link project with library
target_link_libraries(${PROJECT_NAME} PUBLIC curl)

```

[Errors Screenshot](https://gyazo.com/2569e7002bec33660960da7bf9d5ba90)

[My new IDE build settings](https://gyazo.com/6db884217dedc995163bd59fab413cfd)

The library is for x86 & Release and I have specified the flags inside the cmake file to match it, but I still receive incompatibility errors, why is that?

---

<div class="post-metadata">

**Author:** ![josiest](https://discourse.cmake.org/user_avatar/discourse.cmake.org/josiest/32/2208_2.png) [@josiest](https://discourse.cmake.org/u/josiest)\
**Post date:** [March 25, 2024, 4:35pm UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472/2 "2024-03-25T16:35:26Z")

</div>

It looks to me like the error is specifically coming from the duplicate `const` in the signature for `get_full_name` and `get_long_name`. Should the second `const` come after the pointer?

---

<div class="post-metadata">

**Author:** ![Roberto](https://discourse.cmake.org/user_avatar/discourse.cmake.org/roberto/32/4435_2.png) [@Roberto](https://discourse.cmake.org/u/Roberto)\
**Post date:** [March 25, 2024, 4:39pm UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472/3 "2024-03-25T16:39:37Z")

</div>

Thanks for the response, I got past those errors, but now the errors display “skipping incompatible”.

[Error Messages](https://gyazo.com/b63a907e18a46b1cef523a0d3bdff0ef)

---

<div class="post-metadata">

**Author:** ![josiest](https://discourse.cmake.org/user_avatar/discourse.cmake.org/josiest/32/2208_2.png) [@josiest](https://discourse.cmake.org/u/josiest)\
**Post date:** [March 25, 2024, 4:43pm UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472/4 "2024-03-25T16:43:29Z")

</div>

It seems like the library definitions you currently have were compiled with gcc. It’s possible that your new IDE is currently set up to use a different compiler, which would explain why it’s saying “skipping incompatible.” Do you know which compiler your IDE is using?

EDIT: I see your cmake file manually sets the compiler. I wonder if its possible the IDE is overriding this. If not I’m unsure why it would skip those library definitions.

---

<div class="post-metadata">

**Author:** ![josiest](https://discourse.cmake.org/user_avatar/discourse.cmake.org/josiest/32/2208_2.png) [@josiest](https://discourse.cmake.org/u/josiest)\
**Post date:** [March 25, 2024, 4:55pm UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472/5 "2024-03-25T16:55:11Z")

</div>

> [@Roberto](#):
>
> `add_library(curl STATIC "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/curl/lib/libcurl_a.lib")`

This line seems off. Typically the way you link an external library is by first finding the files with [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html), then linking the target like `target_link_libraries(${PROJECT_NAME} PRIVATE CURL::libcurl)`. For Curl specifically, there also seems to be an official [FindCURL module](https://cmake.org/cmake/help/latest/module/FindCURL.html).

My guess is that you’d need to write something along the lines of

```CMake
include(FindCURL)
find_package(CURL REQUIRED)
if (CURL_FOUND)
  target_link_libraries(${PROJECT_NAME} PRIVATE CURL::libcurl)
else() 
  # fail with a useful message
endif()

```

I’ve never linked against curl though, so to some extent I’m just guesing based on the documentation.

It’s possible also, if you’re compiling curl yourself with CMake, that you may want to find Curl in a slightly different way using `find_package(CURL CONFIG REQUIRED)`. This seems to be what [this part](https://cmake.org/cmake/help/latest/module/FindCURL.html#curl-cmake) of the FindCURL module documentation is suggesting. In which case you may also have to add to your prefix path. Something like

```CMake
include(FindCURL)
list(APPEND CMAKE_PREFIX_PATH <path>/<to>/<directory-with-CURLConfig.cmake>)
find_package(CURL CONFIG REQUIRED)

```

Also note, that instead of

```auto
include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/curl/include)

```

you’d probably want to write

```auto
include_directories(${PROJECT_NAME} PUBLIC ${CURL_INCLUDE_DIRS})
```

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [March 26, 2024, 8:57pm UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472/6 "2024-03-26T20:57:05Z")

</div>

@Roberto Your messages are being flagged as spam due to the external links. Rather than linking to an external site hosting screenshots, please attach your image(s) directly to the post and you should avoid the posts being flagged (unless you post lots of images, which may also flag your post). It will also help people searching for things if you can copy-n-paste text as text rather than taking a screenshot of the text.

---

<div class="post-metadata">

**Author:** ![Roberto](https://discourse.cmake.org/user_avatar/discourse.cmake.org/roberto/32/4435_2.png) [@Roberto](https://discourse.cmake.org/u/Roberto)\
**Post date:** [March 26, 2024, 9:52pm UTC](https://discourse.cmake.org/t/gcc-skipping-incompatible-error/10472/7 "2024-03-26T21:52:31Z")

</div>

Thanks for the information, I will do that in the future!
