#94 Problem using Check 0.9.12 + MSVS2010 + Windows 7 32bit

v1.0 (example)
closed-fixed
nobody
None
5
2014-03-20
2014-01-28
No

Hello,

I am trying to compile a file called "test.c" using MSVS 2010 with the following command:

cl.exe test.c /I..\check-0.9.12 /I..\check-0.9.12\src ..\check-0.9.12\build\src\Release\check.lib /Fe.\test.exe /link /LIBPATH:"c:\Program Files\Microsoft Visual Studio 10.
0\VC\lib" /LIBPATH:"c:\Program Files\Microsoft SDKs\Windows\v7.0A\lib"

Unfortunately, it gives me the following error message:

test.c
..\check-0.9.12\src\check.h(528) : error C2061: syntax error : identifier
'check_fork'
..\check-0.9.12\src\check.h(528) : error C2059: syntax error : ';'
..\check-0.9.12\src\check.h(528) : error C2059: syntax error : 'type'
..\check-0.9.12\src\check.h(531) : error C2146: syntax error : missing ')'
before identifier 'pid'
..\check-0.9.12\src\check.h(531) : error C2061: syntax error : identifier
'pid'
..\check-0.9.12\src\check.h(531) : error C2059: syntax error : ';'
..\check-0.9.12\src\check.h(531) : error C2059: syntax error : ')'

I am using check 0.9.12 in Windows 7 32 bit.

Could you please give it a look? Thank you.

Best regards,

R.

Discussion

  • Branden Archer

    Branden Archer - 2014-03-20

    This issue was resolved on the check-devel mailing list. After the discussion, the example packaged with Check was updated to also include a CMake example, to better guide others on how best to setup a CMake project with Check. For future reference, here was the feedback from the check-devel mailing list:

    Looking at check.h, cl.exe is having an issue with the following line:

    CK_DLL_EXP pid_t CK_EXPORT check_fork(void);

    Namely, pid_t is not defined. When Check compiles its own unit tests, it will use CMake to make sure that pid_t is defined to something. From the CMakeLists.txt file:

    check_type_size(pid_t PID_T)
    if(NOT HAVE_PID_T)
    if(WIN32)
    set(pid_t "int")
    else(WIN32)
    MESSAGE(FATAL_ERROR "pid_t doesn't exist on this platform?")
    endif(WIN32)
    endif(NOT HAVE_PID_T)

    For a simple program, the easiest thing may be to just define pid_t to an int before including check.h:

    typedef int pid_t

    include <check.h>

    The better way out, after you have decided to use Check for your project, would be to setup a CMake project that would take care of this for you.

    Check currently has an example, but it is based on autotools. Perhaps I need to create an example project for CMake as well that MSVC or Visual Studios users can use.

    See if the typedef above helps you get past your immediate issue. If not, let me know what happens next. I will look into making an example CMake project that may be useful.

     
  • Branden Archer

    Branden Archer - 2014-03-20
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks