include a.h in main.cpp does not solve the problem. I've got the same error, which is not for surprise, since a.h again is twice defined: in b.o and in main.o On 11/8/05, Aseem Rastogi <aseem@xxxxxxxxxxxxxxxxxxxxxxx> wrote: > do not include a.h in b.h and declate a () as an extern function in b.h > > include a.h in main.cpp. > > it should work. > > Djekic Dusan wrote: > > >a.h is not the file I could change. I am just using it from third > >party. Files in my project are b.h, c.h, and so forth. I forgot that > >all my .h files are enclosed within suitable #ifndef, #define, and > >#endif. And the question is how to have .o files of all b, c, and so > >forth files linked without having multiple definition linking error of > >everything from a, since everything from a is defined twice: > >1 - in b.o (since b.h includes a.h) > >2 - in main.o (since main.cpp includes b.h which includes a.h) > > > >On 11/8/05, Dima Sorkin <dima.sorkin@xxxxxxxxx> wrote: > > > >>On 11/8/05, Djekic Dusan wrote: > >> > >>>a.h > >>>int a( ) { }; > >>> > >>Hi. > >> I have encountered this problem too. > >>Explicitly writing "inline int a() {}" instead > >>of your piece of code helped. > >> > >>Or , if "a" will be a big function (not intended for inlining), > >>you will have to > >>move it's definition into a.cpp, and in a.h there will be > >>only declaration. > >> > >>Regards, > >> Dima. > >> > >> > > > > > -- > The end is always good. If it's not good, it's not the end. > > > >