Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com X-Authentication-Warning: lab1-1.eng.utah.edu: tyoung owned process doing -bs Date: Fri, 2 Mar 2001 16:28:07 -0700 (MST) From: Trace Young To: cygwin AT sourceware DOT cygnus DOT com Subject: call c++ from c Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi, is anybody could help me to point out the problem: my problems is: it could not link while calling a c++ function in cpp file from c function in c file with the main(). both c and cpp files can be compiler in VC++ in NT4.0, but not link the link error message is "unresolved external symbol _cpp_function". ( but I could do those in GUN g++ in Uuix ) following is my code ------------------------------------------------------------------ /*c_file.c*/ #include "c_file.h" int main(){ cpp_function(); return(0); } ---------------------------------------------------------- /*c_file.h*/ #ifndef __cplusplus extern "C++" { #endif #include "cpp_file.h" #ifndef __cplusplus } #endif ------------------------------------------------------------ //cpp_file.cpp #include "cpp_file.h" #include /* foo::foo() { i=0; } */ void cpp_function(){ foo f; f.see(); cout<<"Hi, I am in Cpp file and called by C file\n"< class foo { public: int i; foo() {i=0; } ~foo() {} void see() { cout << "--------------I am inside class ------------" << endl; } }; void cpp_function(); ------------------------------------------------------------------------------------ Thank for any help. Trace -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple