I am using a recompiled version of the GCC toolchain for the ARM platform, called Yagarto. The compiler comes with a "standard library" called Newlib, and "standard headers", such as stdio.h.

For my project, the licencing of Newlib is not suitable, so I have used a printf function from somewhere else. The problem is that it seems the build-in header files are implicitly included in every .c file, and I'm getting the following error:

c:/yagarto4.6.0/lib/gcc/../../arm-none-eabi/sys-include/stdio.h:182:5: error: conflicting types for 'printf'

Is there a way to have Yagarto not load the standard libraries by default?

  • \$\begingroup\$ Can you just remove/rename the original standard libraries? \$\endgroup\$ Aug 14, 2012 at 22:34

1 Answer 1


From the GCC man page:

-nostdinc Do not search the standard system directories for header files. Only the directories you have specified with -I options (and the directory of the current file, if appropriate) are searched.

-nostdinc++ Do not search for header files in the C++-specific standard directories, but do still search the other standard directories. (This option is used when building the C++ library.)

Other options would be explicitly referencing the header files you do want to include, specifying their directory with -I (which is searched before the standard includes). Or you could simply remove (or move) the incompatibly licensed headers' directory from the installation.

You may also want -nostdlib to the linker.

  • \$\begingroup\$ Thanks. Do you know if there is a way to only ignore the header for printf? \$\endgroup\$
    – Randomblue
    Aug 14, 2012 at 16:30
  • \$\begingroup\$ If you are trying to avoid the library, why do you want it's headers? Even if only for technical reliability I would think you would want to entirely exclude dependence on them, in favor of your own with content you can more easily track. \$\endgroup\$ Aug 14, 2012 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.