Skip to content

ThirdParty\GDCM\src\gdcm\Source\Common\gdcmSystem.cxx(815,3): error C3861: 'gettimeofday': identifier not found  #2362

Closed

Description

@al-sabr

ITK 4.13 downloaded by CTK

image

2> G:\programming\cpp\CTK\build\ITK\Modules\ThirdParty\GDCM\src\gdcm\Source\Common\gdcmSystem.cxx(815,3): error C3861: 'gettimeofday': identifier not found [G:\programming\cpp\CTK\build\ITK-build\Modules\ThirdParty\GDCM\src\gdcm\Source\Common\gdcmCommon.vcxproj]

Activity

  1. added
    type:Bug
    on Mar 4, 2021
  2. al-sabr commented on Mar 4, 2021

    @al-sabr
    Author

    I added these lines in gdcmSystem.cxx in line 49 for ITK 4.13

    #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) ||defined(__BORLANDC__) || defined(__MINGW32__))
    #include <io.h>
    #include <direct.h>
    #define _unlink unlink
    
    #include <chrono>
    
    int gettimeofday(struct timeval* tp, struct timezone* tzp) {
        namespace sc = std::chrono;
        sc::system_clock::duration d = sc::system_clock::now().time_since_epoch();
        sc::seconds s = sc::duration_cast<sc::seconds>(d);
        tp->tv_sec = s.count();
        tp->tv_usec = sc::duration_cast<sc::microseconds>(d - s).count();
    
        return 0;
    }
    
    #else
    

    The compilation error is gone now :D

  3. dzenanz commented on Mar 4, 2021

    @dzenanz
    Member

    This is maybe due to some conditional compilation enabling Linux code. @malaterre might know more.

  4. al-sabr commented on Mar 4, 2021

    @al-sabr
    Author

    Well it seems that linux code is being compiled on Windows. But with the little addition I did it compile fully. Maybe that's a temporary solution what do you think @malaterre ?

  5. thewtex commented on Mar 5, 2021

    @thewtex
    Member

    This is not an issue with GDCM or ITK but @al-sabr 's fork.

  6. al-sabr commented on Mar 7, 2021

    @al-sabr
    Author

    This is a dependency issue concerning a Superbuild which uses external projects as dependency based on CTK which itself is depending on ITK, VTK and other third party libraries. It has nothing to do with my fork. My fork is using those dependencies equally as CTK uses them. I request you reopen this issue until we get @malaterre's input.

    Before you close anything I would ask you to get a bigger understanding of what is going on with those tickets. This is not only one ticket there's many tickets which are connected with each other.

    I already exposed many explanations concerning what was told to be possible within ITK's documentation and what was actually possible in reality.

  7. al-sabr commented on Mar 7, 2021

    @al-sabr
    Author

    And actually I followed many of the recommendations proposed by @dzenanz and still could not achieve what I intended to.

  8. thewtex commented on Mar 9, 2021

    @thewtex
    Member

    CTK has worked with ITK, VTK and other third party libraries for quite some time. I have contributed to CTK -- I am aware of the project. The problems you are encountering are created by your fork. To address issues in a maintainable way without creating more issues, update CTK, MITK, to use the latest version of ITK and other third party dependencies without deviating from the upstream library.

  9. al-sabr commented on Apr 19, 2021

    @al-sabr
    Author

    This is a false positive it seems that the following flag gets enabled by default:

    ```

    //Have function gettimeofday

    GDCM_HAVE_GETTIMEOFDAY:INTERNAL=1

    ```

    I really don't understand why does it enabled it by default but when I set it back to

    ```//Have function gettimeofday

    GDCM_HAVE_GETTIMEOFDAY:INTERNAL=```

    The compilation goes through!

    You can remove this pull request because the problem is not in code but CMAKE variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions