From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: Linking all my files together? Date: Wed, 30 Sep 1998 18:41:51 -0400 Organization: Nocturnal Aviation Lines: 41 Message-ID: <3612B3AF.9BEDE68@earthlink.net> References: <19980930171354 DOT 09201 DOT 00004352 AT ng18 DOT aol DOT com> NNTP-Posting-Host: 1cust181.tnt11.nyc3.da.uu.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Posted-Path-Was: not-for-mail X-ELN-Date: Wed Sep 30 15:39:09 1998 X-Mailer: Mozilla 4.06 [en] (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Dupheraire wrote: > > Just came across another problem that had bugged me when using this compiler > before. For some reason it is trying to compile and link the two different > .cpp files together that I have made. 1st program is- When you try to use two different (misdefined) identifiers with external linkage with the same name, of course the compiler finds both of them. What did you expect? And throw your Herb Schildt book away. > > #include > void main() > { > cout << "Hello"; > } > > 2nd program is > > #include > void main() > { > cout << "Please enter the number of gallons you wish to see the cubic "; > cout << "feet equivalant of."; > float cubicfeet, gallons; > cin >> gallons; > cubicfeet = gallons / 7.481; > cout << "equivalant in cubic feet is " << cubicfeet; > } > > When I try to compile the 2nd one I get these errors: > Error:hello.o: In function 'main' > Error:hello.cpp(.text+0x8): multiple definitions of 'main' > Error:exer1_1.o(.text+0x78):exer1_1.cpp:first defined here > > Know what is wrong? -- Martin Ambuhl (mambuhl AT earthlink DOT net) Note: mambuhl AT tiac DOT net will soon be inactive