conflicting types

conflicting types for ´someFunction´

struct sa0 {
int a;
int b;

struct sa1 {
int a;
int b;

void someFunction( int ia, int ib, struct sa0 bla0, struct sa1 bla1){
int someDecl;
struct sa2 bla2;

   some Code here


This is a skel for all nonworking functions in our big project.
Somehow, while compiling with:
qcc -Vgcc_ntox86 -w8 -wapproto -O0 -g -I. -c -o output.o …/input.c
a lot of functions including structs in the functionheader, also defined via prototype (approto input.c > proto.h), result in an error i am not getting rid of.

conflicting types for `someFunction’

All Libs are present, everything else compiles fine.
The name is uniqe, also the struct names are uniqe.
all headers are present, everything works find but a lot of functions.

Somehow i think im missing something somewhere …

I don’t have access to qcc right now, but I was able to run gcc.
I found that it didn’t like three things in your example.

  1. The structure definitions don’t end with a ‘;’
  2. The structure sa2 was undefined
  3. someFunction() does not have a prototype

When I corrected these three things, the code compiled with gcc.

The example was quite bad i think

  1. they end with ; in normal code
  2. they are all known
  3. it has in proto.h ^^

And i guess there is the problem too, proto.h complains about the function already defined and input.c complains about the function having conflicting types.
Also when i try to auto-switch to the declaration of the struct, it points to the prototype in proto.h
But this behaviour is just within this some functions, all other 25 function in input.c work fine …

I think a good place to start would be by creating and then posting some code that that by itself causes the problem. Often this exercise reveals the problem.

I finally found a way to strip out the error, this code WON´T compile.
The problem is proto.h is included before the structure is defined (this worked fine with Watcom)
This makes producing the error conflicting types for the fuction itself and previous declaration for the prototype …

And no it is not possible to include proto.h later in the source in production code, there are about 22k lines of code in this one file and about 2k lines of structures including ptr-to-functions etc.


#include <stdio.h>
#include <stdlib.h>

#include “proto.h”

struct ts3 {
int a;
int b;

int main(void){

   struct ts3 sects3;

   mytestfunc( &sects3 );
   return 0;


mytestfunc( struct ts3 *ts3st ){
int i;
for( i=0; i<2; i++ ){
// big Do-Nothing-Loop, adepted from M$-Windoof


CC = qcc
CXX = qcc
LD = qcc

CFLAGS = -w8 -wapproto -I.
LDFLAGS = -Bstatic

Application Program

-rm -f …/proto.h
c:/Programme/QNX630/host/win32/x86/usr/photon/appbuilder/approto -p test.c > proto.h
$(CC) $(CXXFLAGS) -c -o test.o test.c
$(LD) test.o $(LDFLAGS) -M -o myApp

I haven’t confirmed the example, but let me restate what you seem to be saying for clarification.

  1. You have code where there are function declarations with pointers to structures that are defined later in the code.
  2. This code won’t compile either because of a GNU compiler quirk, or even possibly because the GNU compiler is correct.
  3. This is annoying because the Watcom compiler didn’t have this quirk

I didn’t understand your reasoning for why you can’t move the proto.h. Are you saying that it is impossible to move it,
or that you just don’t want to?

Assuming this is all true, what kind of solution would hope for? A compiler fix or modification?
I suppose there might be some compiler flag that might help, since I have the GNU manual,
I’ll take a look.

You need to forward declare your structures either in proto.h or before it.


struct ts3;

#include <proto.h>

struct ts3 {


It works fine with “prototyping” the structures too.
Thanks a lot.

To awnser your questen maschoen, no it was not possible to rearrange the proto.h-include or the structures,
since there are structuredefinition which have pointer to functions inside. This functions are prototyped in proto.h
but have the structure itself as parameter too (something like this^^). I already tried this for 5 days and was
very frustrated at every evening :smiley:
But that makes me even more happy now … rm source.c && mv source.c.old source.c

Now only thing that is left is a sed or similar to automatically create a “protostruct.h” :slight_smile: