home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!news.columbia.edu!cunixb.cc.columbia.edu!kps
- From: kps@cunixb.cc.columbia.edu (Karthik P Sheka)
- Subject: linking gcc code with CC code
- Message-ID: <1992Jul30.182047.18971@news.columbia.edu>
- Keywords: link
- Sender: usenet@news.columbia.edu (The Network News)
- Nntp-Posting-Host: cunixb.cc.columbia.edu
- Reply-To: kps@cunixb.cc.columbia.edu (Karthik P Sheka)
- Organization: Columbia University
- Date: Thu, 30 Jul 1992 18:20:47 GMT
- Lines: 29
-
-
- Is it possible to link gcc created object files with CC created object
- files? I've tried doing so but it seems that the c functions cannot call
- the c++ functions, even though the c++ functions are not in any class.
- Sample code follows... (The error returned is Undefined symbol: routine2)
-
- /*****C++ code*****/
- #include <iostream.h>
- extern "C"{
- int routine1(void);
- };
-
- int main(void)
- {
- cout << routine1();
- }
- static int routine2(void)
- {
- return 2;
- }
-
-
- /*****C code*****/
- extern int routine2();
-
- int routine1(void)
- {
- return(routine2());
- }
-