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

Eric Noulard eric.noulard at gmail.com
Wed Jul 8 06:52:51 EDT 2009


2009/7/8 Steven Van Ingelgem <steven at vaningelgem.be>:
> 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'
>
>
> What I understand is that the snprintf type exists, but conflicts with the
> built-in version... So this should return 'true' in fact...
>
> What can I do about it?

Disable builtin support with
SET(CMAKE_REQUIRED_FLAGS "-fno-builtin")
see: http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/C-Dialect-Options.html#C-Dialect-Options

or

update CheckFunctionExists.cmake in order to make it try builtin first?

or

update CheckFunctionExists.cmake in order to make it catch the
"conflicting types for built-in function"
and return true in this case?


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list