public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* c anc c++ compiling
@ 2002-01-27  5:57 ratnadeep  joshi
  2002-01-27  6:12 ` Stephano Mariani
  0 siblings, 1 reply; 2+ messages in thread
From: ratnadeep  joshi @ 2002-01-27  5:57 UTC (permalink / raw)
  To: gcc


hello ,

  
   1.  I compiled and linked two source files one       
       of which is c and other is c++ . I called        
       a function which was in c++ file from c file .   
       gcc flagged an error..

       I gave :
 
       $>gcc a.c a.cpp

        Error was  : undefined reference to that 	
               	     function
   
        When i ran the same with g++ , it worked
 
        $>g++ a.c a.cpp 
 
         No error

         What happens exactly ?

      2. Now i want to add c++ code to objc compiler    
         cc1obj . i.e i will link one more file which 	
	 is .cpp with other objc source files which are 
          .c . Here the same problem arises .
          The thing that we can't make here compiler    
         g++ as it happens through stages..and it       
         changes

           What can be done for this ?

        
         Thanking you in anticipation ...
 
         - Ratnadeep Joshi      


 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: c anc c++ compiling
  2002-01-27  5:57 c anc c++ compiling ratnadeep  joshi
@ 2002-01-27  6:12 ` Stephano Mariani
  0 siblings, 0 replies; 2+ messages in thread
From: Stephano Mariani @ 2002-01-27  6:12 UTC (permalink / raw)
  To: 'ratnadeep  joshi', gcc

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The unresolved references that you are getting are the c++ library,
which only g++ adds by default. If you want to use gcc, then do it
like this:

gcc -x c <your c source files here> \
- -x c++ <your c++ sources here> \
- -x objc <your objc sources here> \
<rest of your commandline here> \
- -lstdc++ \
<rest of  your libs here>


Stephano Mariani

- -----Original Message-----
From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf
Of ratnadeep joshi
Sent: Sunday, 27 January 2002 9 13
To: gcc@gcc.gnu.org
Subject: c anc c++ compiling


hello ,

  
   1.  I compiled and linked two source files one       
       of which is c and other is c++ . I called        
       a function which was in c++ file from c file .   
       gcc flagged an error..

       I gave :
 
       $>gcc a.c a.cpp

        Error was  : undefined reference to that 	
               	     function
   
        When i ran the same with g++ , it worked
 
        $>g++ a.c a.cpp 
 
         No error

         What happens exactly ?

      2. Now i want to add c++ code to objc compiler    
         cc1obj . i.e i will link one more file which 	
	 is .cpp with other objc source files which are 
          .c . Here the same problem arises .
          The thing that we can't make here compiler    
         g++ as it happens through stages..and it       
         changes

           What can be done for this ?

        
         Thanking you in anticipation ...
 
         - Ratnadeep Joshi      


 


-----BEGIN PGP SIGNATURE-----
Version: PGP 7.1.1
Comment: Use PGP or GNUPG

iQA/AwUBPFPoVGgk66Ms+o9zEQI2IQCfdR7kU+a/x1ZGCqoEX/VEsp3wgmcAoLOG
Z0J5HAuSA5ET+f8cK7MFaESV
=d1re
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-27 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-27  5:57 c anc c++ compiling ratnadeep  joshi
2002-01-27  6:12 ` Stephano Mariani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).