Skip to main content
4-Participant
January 8, 2023
Question

Using Creo TOOLKIT, error C2040 is happened.

  • January 8, 2023
  • 1 reply
  • 758 views
I am using Creo Parametric Release 9.0 and Datecode9.0.0.0

1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_malloc.h(66,15): error C2040: 'calloc': 'void *(size_t,size_t)'의 간접 참조 수준이 'int ()'과(와) 다릅니다.

I am using Microsoft Visual Studio 2019 with Creo 9 TOOLKIT. For more information, I attach my working source - tony_examples.zip

Here are the errors that I faced
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_malloc.h(66,15): error C2040: 'calloc': 'void *(size_t,size_t)'의 간접 참조 수준이 'int ()'과(와) 다릅니다.

    1 reply

    17-Peridot
    January 10, 2023

    Hi @TH_9219052 

     

    Note: The proper community topic for Toolkit Customization is https://community.ptc.com/t5/Customization/bd-p/customization

     

    You are including corecrt_malloc.h header which belongs to Windows Kits 10.0.15063.0, right?

    You are facing this error (English): error C2040: 'calloc': differs in levels of indirection from 'int ()'

    You did not attach anything yet. Please do.

     

    This error is thrown by the compiler, which means the solution is rather in your code, and Toolkit is working as designed.

    It means you didn't declare that function before usage (you used it, but did not declare it prior).

    In such case, the compiler implicitly declare it automatically as a function returning int.

    When you use it (void) then the wrong declaration becomes obvious and the error appears.

     

    Solution:

     

    Declare the function before you use it.

    OR Visual Studio 2019 version 16.4.2 and 16.4.3 compilers are experiencing this problem. Please refer to this article and then update to the appropriate Visual Studio release:

    https://www.ptc.com/en/support/article/cs44547

    OR share your code and full product release info

     

    Regards, Michael