Skip to content

Missing cmath include, certain Linux linking issues #3

@lamweilun

Description

@lamweilun

Please add #include <cmath> as its complaining that its missing references to std::pow and std::fpclassify

Also on a separate note, on Linux, I have to manually link Intel TBB in my CMake. Maybe you could bundle it together in your CMakeLists?

Below is my example, using CPM.cmake, to get things to compile and link. Tested with gcc-14 and clang-18

# CMakeLists.txt
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

file(
  DOWNLOAD
  https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.2/CPM.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)

project(cpm)

CPMAddPackage("gh:Compaile/ctrack#v1.0.0")

find_package(TBB REQUIRED)

add_executable(
  ${PROJECT_NAME}
  main.cpp
)

target_compile_features(
  ${PROJECT_NAME} 
  PRIVATE 
  cxx_std_20
)

target_link_libraries(
  ${PROJECT_NAME}
  PRIVATE
  TBB::tbb
  ctrack
)
// main.cpp
#include <iostream>

#include <cmath> // Needed for std::pow and std::fpclassify
#include <ctrack.hpp>

void printFunc() {
  CTRACK;
  std::cout << "Print" << std::endl;
}

int main() {
  printFunc();
  ctrack::result_print();
  return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions