Giter Club home page Giter Club logo

Comments (5)

adrian-ollero avatar adrian-ollero commented on June 3, 2024

In the end I was able to solve it changing the content of the Math.h file like this:

#include <cmath>

#if defined(_WIN32) || defined(_WIN64)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#include <math.h>
#endif

@Framstag I could create a PR so if you consider it is worthy and there is no other solution, maybe you could add it to master,

Thanks

from libosmscout.

Framstag avatar Framstag commented on June 3, 2024

The clean solution would be to use https://en.cppreference.com/w/cpp/numeric/constants - but we are not yet C++20 :-(

For our builds we set the define via compiler options (take a look at meson.build for example). So this is fixed a cenral place. Would this solution possible for you, too?

from libosmscout.

adrian-ollero avatar adrian-ollero commented on June 3, 2024

I'm actually using CMake, and I can see the macro definition is included in the CMakelist of this project. The compilation of the library for windows is done as follows:

if not exist "%LIBOSMSCOUT_SOURCE_PATH%" git clone %LIBOSMSCOUT_REPO% %LIBOSMSCOUT_SOURCE_PATH%

if not exist "%LIBOSMSCOUT_VSPROJECT_PATH%" mkdir "%LIBOSMSCOUT_VSPROJECT_PATH%"
cd "%LIBOSMSCOUT_VSPROJECT_PATH%"

cmake -G "Visual Studio 16 2019"^
    -DCMAKE_INSTALL_PREFIX="%DEPENDENCIES_INSTALLATION_PATH:\=/%"^
    -DCMAKE_CXX_FLAGS_RELEASE="/EHsc"^
    -DOSMSCOUT_BUILD_TOOL_STYLEEDITOR=OFF^
    -DOSMSCOUT_BUILD_TOOL_OSMSCOUT2=OFF^
    -DOSMSCOUT_BUILD_TESTS=OFF^
    -DOSMSCOUT_BUILD_CLIENT_QT=OFF^
    -DOSMSCOUT_BUILD_DEMOS=OFF^
    "%LIBOSMSCOUT_SOURCE_PATH%"

cmake --build . --config=Release --target install

This process is done correctly. The library get installs in my project, however, after that, when compiling my project itself, some lines below in the .bat file. So far, everything seems to be configured correctly, but the error is still comming up, as far as I don't include the lines stated in the previuos comment. I'm sure there is something I'm doing in the worng way or missing something...

Thank you so much for your quick reply!

from libosmscout.

Framstag avatar Framstag commented on June 3, 2024

The relevant code for libosmscout is in the CMakeList.txt in the root directory in line 154

add_definitions(-D_USE_MATH_DEFINES)

It is possible, that you add this you build, too?

from libosmscout.

adrian-ollero avatar adrian-ollero commented on June 3, 2024

Finally solved. As you mentioned, I had to add add_definitions(-D_USE_MATH_DEFINES) to my CMake file as I was including the math.h header indirectly within my project, so my project needed the _USE_MATH_DEFINES macro to be activated.

Thanks.

from libosmscout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.