From patchwork Wed Jan 16 04:23:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [U-Boot] Function prototype conflicts with standalone apps Date: Tue, 15 Jan 2013 18:23:58 -0000 From: Chris Packham X-Patchwork-Id: 212386 Message-Id: To: u-boot Hi, I've just run into something porting an existing out of tree board to u-boot 2012.10 but I think it points to a generic issue for standalone applications. Consider the following change Because I'm not linking with the u-boot object file, I should be able to use any function name I like in my application as long as it isn't one of the functions in exports.h (at least in theory). Unfortunately I end up with the following compiler error hello_world.c:27: error: conflicting types for ‘net_init’ uboot/include/net.h:489: error: previous declaration of ‘net_init’ was here make[1]: *** [hello_world.o] Error 1 If I replace #include in my app with the first hunk of includes from the top of common.h then I can compile just fine. I was wondering if it made sense to people to have standalone applications define something like __STANDALONE__ either via CPPFLAGS or in the source itself and use the presence of that to exclude the majority of common.h when used in standalone applications. Or alternatively move the required bits to exports.h. Thanks, Chris diff --git a/examples/standalone/hello_world.c b/examples/standalone/hello_world.c index 067c390..d2e6a77 100644 --- a/examples/standalone/hello_world.c +++ b/examples/standalone/hello_world.c @@ -24,7 +24,7 @@ #include #include -int hello_world (int argc, char * const argv[]) +int net_init (int argc, char * const argv[]) { int i;