realm-cpp icon indicating copy to clipboard operation
realm-cpp copied to clipboard

Failed to build using cmake on linux

Open danielmbomfim opened this issue 1 year ago • 3 comments

I am trying to build a very simple application using cmake and realm as a database. When trying to build using cmake on linux i am facing some errors about imports from the std namespace.

error: ‘uint_fast16_t’ in namespace ‘std’ does not name a type
cpprealm-src/src/cpprealm/internal/bridge/realm.hpp:29:1: note: ‘std::uint_fast16_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?

I dont have much experience using c++ so i'm not sure if it's a error or some configuration problem.

This is my cmakelists file:

cmake_minimum_required(VERSION 3.15)

project(RealmRs)

set (REALM_CPP_NO_TESTS ON )
set(CMAKE_CXX_FLAGS "-fpermissive -Wchanges-meaning")

# Minimum C++ standard
set(CMAKE_CXX_STANDARD 17)

# In a Windows install, set these compiler flags:
if(MSVC)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor /bigobj")
endif()

# Include the FetchContent module so you can download the C++ SDK
Include(FetchContent)

# Declare the version of the C++ SDK you want to download
FetchContent_Declare(
  cpprealm
  GIT_REPOSITORY https://github.com/realm/realm-cpp.git
  GIT_TAG        v1.0.0
)

# The MakeAvailable command ensures the named dependencies have been populated
FetchContent_MakeAvailable(cpprealm)

add_library(test main.cpp)

target_link_libraries(test PRIVATE cpprealm)

danielmbomfim avatar Feb 25 '24 18:02 danielmbomfim

➤ PM Bot commented:

Jira ticket: RCPP-50

sync-by-unito[bot] avatar Feb 25 '24 18:02 sync-by-unito[bot]

@danielmbomfim Please tell us which compiler (and version) you are using and which platform you are targeting.

kneth avatar Mar 06 '24 11:03 kneth

@kneth I'm using gcc 12.3.0 targeting linux

danielmbomfim avatar Mar 06 '24 20:03 danielmbomfim