There are two head files _stub_defs.h
///stub code
#pragma once
#include "random.h"
#include <stdarg.h>
and stasrg.h
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif
When I use my cross-compiler(sparc-rtems-gcc) to compile, the two head files both are included.Then the terminal tells me:
warning: #pragma once is obsolete
stdarg.h: conflicting types for `__gnuc_va_list'stdarg.h: previous declaration of `__gnuc_va_list'
Obviously, #include guards does not work.Is this the problem of head files' codes or the problem of my cross-compiler?
_stub_defs.ha toolchain header or could you modify it? If you can use there the same approach ofstasrg.h. - LPsstasrg.hfrom? (It isn't a standard header that I've come across — it is a typo for<stdarg.h>?) If you wrote it, you have no business doing that. That said, if you're compiling in C11 mode and the typedefs are the same, you shouldn't get that error. And you should get rid of#pragma once— header guards work as long as they're not misused. - Jonathan Leffler