And you are sure your compiler takes the C file and treats its contents as C++ source? I think this might also be a problem. If you have changed that behaviour you should better go and rename it to .cc or .cpp instead because it is more segnificant either for you and the other programms and for the compiler which language it contains.