Menu

#12 M_PI and NAN undefined (MSVC)

fixed
nobody
None
2014-11-29
2014-10-12
letmaik
No

I'm still having trouble compiling 0.3 (with isfinite fix) with MSVC:

lensfun\modifier.cpp(90) : error C2065: 'M_PI' : undeclared identifier
lensfun\modifier.cpp(126) : error C2065: 'NAN' : undeclared identifier
lensfun\modifier.cpp(225) : error C2065: 'NAN' : undeclared identifier

The following pages refer to these issues:

https://stackoverflow.com/questions/6563810/m-pi-works-with-math-h-but-not-with-cmath-in-visual-studio

http://tdistler.com/2011/03/24/how-to-define-nan-not-a-number-on-windows

I use VC 2008 but the issues apply also to 2010. I think 2010 should still be supported.

Discussion

  • Torsten Bronger

    Torsten Bronger - 2014-10-13

    Please test the branch mvc-math.

     
    • letmaik

      letmaik - 2014-10-13

      Getting closer, math errors are gone. Now I hit two problems of which I
      could solve one.

      The first is in auxfun.cpp it couldn't find stdint.h. This only exists >=MSVC 2010. But actually auxfun.cpp doesn't use anything from that header, so I removed the include and got rid of the error.

      The other error happens in the install step:

      CMake Error at cmake_install.cmake:99 (file):
      file INSTALL cannot find
      "C:/Users/maik/git/lensfunpy/external/lensfun/GLIB2_DLL-NOTFOUND".

      which is strange as I explicitly specify -DGLIB2_BASE_DIR and it is
      found in the configure step:

      Using:
      -- GLIB2 include dir:
      C:/Users/maik/git/lensfunpy/external/lensfun/glib-2.0/lib/glib-2.0/include;C:/
      Users/maik/git/lensfunpy/external/lensfun/glib-2.0/include/glib-2.0
      -- GLIB2 library:
      C:/Users/maik/git/lensfunpy/external/lensfun/glib-2.0/lib/glib-2.0.lib
      -- Configuring done

       

      Last edit: letmaik 2014-10-13
      • seebk

        seebk - 2014-10-23

        On windows CMake is also looking for the .dll file and not only for the .lib.

        The .lib is used for linking. When the libray is installed the glib2.dll is copied next to the lensfun.dll where it is needed at runtime.

        This whole procedure was not really clearly defined in the CMake files before. I have now improved the search procedure for the glib2.dll. Additonally the DLL is no more mandatory but only installed if it was found. If you have further comments on how to improve the build process on windows please tell us! The windows port is only roughly tested and rarely used...

         
        • letmaik

          letmaik - 2014-10-23

          I just tested master merged with mvc-math and compilation went fine.
          Thanks for the fixes! You can merge mvc-math now I guess.

          It's a shame that lensfun is not on github, otherwise you could easily
          use Travis CI for Linux and Mac testing and Appveyor.com for Windows
          testing. I do that currently for my lensfun Python wrapper.

           
          • seebk

            seebk - 2014-11-29

            Mvc-Math is now merged into master.

             
  • Torsten Bronger

    Torsten Bronger - 2014-10-13

    I removed stdint.h from the branches master and mvc-math. Thank you for the feedback!

    I cannot help with the installation problem I'm afraid. I have no testbed for it, and no experience with building under Windows. Maybe Sebastian can say something about it when he's back (in 10 days).

     

    Last edit: Torsten Bronger 2014-10-13
  • seebk

    seebk - 2014-11-29
    • status: open --> fixed