From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25880 invoked by alias); 8 Nov 2005 10:31:57 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 25867 invoked by uid 22791); 8 Nov 2005 10:31:54 -0000 Received: from india.tejasnetworks.com (HELO anche.india.tejasnetworks.com) (164.164.94.83) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 08 Nov 2005 10:31:54 +0000 Received: from localhost (unknown [127.0.0.1]) by anche.india.tejasnetworks.com (*****) with ESMTP id 3CD3E73A1C; Tue, 8 Nov 2005 10:28:30 +0000 (UTC) Received: from anche.india.tejasnetworks.com ([127.0.0.1]) by localhost (anche [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23993-06; Tue, 8 Nov 2005 15:58:28 +0530 (IST) Received: from india.tejasnetworks.com (aseem.india.tejasnetworks.com [192.168.0.38]) by anche.india.tejasnetworks.com (*****) with ESMTP id 99FFE73A23; Tue, 8 Nov 2005 15:58:28 +0530 (IST) Message-ID: <4370808B.8070607@india.tejasnetworks.com> Date: Tue, 08 Nov 2005 10:31:00 -0000 From: Aseem Rastogi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408 MIME-Version: 1.0 To: Djekic Dusan Cc: gcc-help@gcc.gnu.org Subject: Re: Compiling and Linking help References: <8d192cb80511080031r10a1ba6br214c6431bfe23e91@mail.gmail.com> <8d192cb80511080153gcd1d12dm312f3434492b6f06@mail.gmail.com> <437078F6.9050805@india.tejasnetworks.com> <8d192cb80511080210u7f890742jedad4b0f5f88a770@mail.gmail.com> <43707D14.5020506@india.tejasnetworks.com> <8d192cb80511080220o20aa9b90rf7b63e5127f6ab0e@mail.gmail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-11/txt/msg00096.txt.bz2 i would suggest rewrite a.h for better future. its not important what you get from ur predecessors but what you leave behind for ur successors. :) Djekic Dusan wrote: >unfortunately a.h also have some classes declarations and >implementations within it, and in b.h I declare pointers to some of >those classes. > >On 11/8/05, Aseem Rastogi wrote: > >>may be this will works. >> >>include a.h in b.cpp and not in b.h if possible. >> >>Djekic Dusan wrote: >> >>>the previous message was a mistake, since I have not correctly the first line. >>>Yes, you are right about it. But, in reality, a.h includes many >>>functions, and including all of them is rather tedious job. Is there >>>any other solution? >>> >>>On 11/8/05, Aseem Rastogi 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 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. >>>> >>>> >>>> >>>> >> >>-- >>The end is always good. If it's not good, it's not the end. >> >> >> >> > -- The end is always good. If it's not good, it's not the end.