[CMake] conflicting types for built-in function 'snprintf'

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Jul 9 03:20:37 EDT 2009


On Wed, Jul 8, 2009 at 11:22 PM, Alexander
Neundorf<a.neundorf-work at gmx.net> wrote:
> On Wednesday 08 July 2009, Steven Van Ingelgem wrote:
>> Hi,
>>
>>
>> I tried this call:
>> CHECK_FUNCTION_EXISTS(snprintf  HAS_snprintf)
>>
>>
>> Which results in this error being generated:
>> C:\MinGW\bin\gcc.exe   -g -ggdb -O0 -Wall -Werror
>> -DCHECK_FUNCTION_EXISTS=snprintf   -o
>> CMakeFiles\cmTryCompileExec.dir\CheckFunctionExists.c.obj   -c "C:\Program
>> Files\CMake 2.7\share\cmake-2.7\Modules\CheckFunctionExists.c"
>> cc1.exe: warnings being treated as errors
>> C:\Program Files\CMake 2.7\share\cmake-2.7\Modules\CheckFunctionExists.c:3:
>> error: conflicting types for built-in function 'snprintf'
>
> Did you try using check_symbol_exists() ?

Indeed.

Ref:
http://public.kitware.com/Bug/view.php?id=8246

Solution:
INCLUDE(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(strcasecmp "strings.h" HAVE_STRCASECMP)
CHECK_SYMBOL_EXISTS(strncasecmp "strings.h" HAVE_STRNCASECMP)
CHECK_SYMBOL_EXISTS(snprintf "stdio.h"    HAVE_SNPRINTF)

2cts
-- 
Mathieu


More information about the CMake mailing list