delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/30/17:16:12

From: dupheraire AT aol DOT com (Dupheraire)
Newsgroups: comp.os.msdos.djgpp
Subject: Linking all my files together?
Lines: 33
NNTP-Posting-Host: ladder02.news.aol.com
X-Admin: news AT aol DOT com
Date: 30 Sep 1998 21:13:54 GMT
Organization: AOL http://www.aol.com
Message-ID: <19980930171354.09201.00004352@ng18.aol.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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-

#include <iostream.h>
void main()
{
cout << "Hello";
}

2nd program is

#include <iostream.h>
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?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019