delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/24/15:01:37

From: kdawghu AT hotmail DOT com (Kris Mills)
Newsgroups: comp.os.msdos.djgpp
Subject: What is the differnce between GCC and GXX Please help
Date: Sat, 24 Jan 98 18:54:16 GMT
Organization: VisiNet InterNetNews site
Lines: 93
Message-ID: <6add6e$6l0$1@madrid.visi.net>
NNTP-Posting-Host: ppp-5-01.nn.visi.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Please Can anyone help me my code compiles fine with GXX but not with GCC Why?
I thought gCc could compile c++ code.
I know that the user_input should be a String  but i can't compile it that 
way.

Also i get this when i type GXX at the prompt i think i should get no 
input file.

e:/djgpp/lib\crt0.o(.data+0x92):crt0.s: undefined reference to `main'
e:/djgpp/lib/libc.a(crt1.o)(.text+0x312):crt1.c: undefined reference to `main'

Please help Me kdawghu AT hotmail DOT com



#include <iostream.h>
#include <stdlib.h>
#include <String.h>

main()
{

char *user_input;                    // Stores the input stream from cin
int prg_exit;                        // Stores the value that the program
                                     // returns on exit. if prg_exit is
                                     // Other then zero then program exited
                                     // explictly.

bool allprgfine;                     // Defines allprgfine as true or false   
allprgfine=true;                     // Inital value set to true   


do {        // Starts a loop that ends when the user types endp inlower case

                                
// Outputs the display message
cout << endl << "Type endp to quit this program." << endl; 
cout << "Enter a command now:  "; 

cin  >> user_input;       // Gets input and places it into user_input
cout << endl;             // Prints blank line.


// Checks if user_input is equal to "endp"
// If so it does not pass the user_input to the system function.
// command.

if (strcmp(user_input,"endp") != 0)


{

// System(*char) executes whatever text in user_input.
// System returns a int that tells if the program run exited properly

prg_exit=system(user_input); 


// checks if prg_exit is greater then 0
// if so program not end properly.

if (prg_exit > 0)
{
allprgfine=false;
   }
}

else
{
if  (allprgfine != true)
{
cout << "*** One or more programs did not exit properly when run. ***" <<endl;
}
else
{
cout << "*** All programs run and exited properly. ***" << endl;
}


// If user_input is equal "endp" then prints exit
// Greeting message.
cout << "bye, please run this program again :)";



}

// Ends when user_input is equal to "endp"
} while (strcmp(user_input,"endp") != 0);


return 0;        // The main function returns nothing just reinforces that
}

- Raw text -


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