>>>>> "Binand" == Binand Raj S <[EMAIL PROTECTED]> writes:
>> BTW the reverse also works, compiling a cpp program with gcc, if you
>> follow the conventional suffixes for src files. It wouldnt link
>> though as gcc by default will try to link with the std C library,
>> but you can easily fix that by explicitly linking with libstdc++
Binand> I don't understand what you are saying here, but please show me
Binand> the exact steps you'd take to compile this C++ program under a
Binand> C compiler:
Binand> ie, please demonstrate how you'd compile a C++ program with a
Binand> purely C compiler.
[anoop@lonewolf:anoop]$ cat a.C
#include <iostream>
int main (void) {
cout << "Hello World" << endl;
return 0;
}
[anoop@lonewolf:anoop]$ gcc -x c++ a.C -o /dev/null
/tmp/ccToXLn1.o: In function `main':
/tmp/ccToXLn1.o(.text+0xa): undefined reference to `endl(ostream &)'
/tmp/ccToXLn1.o(.text+0x17): undefined reference to `cout'
/tmp/ccToXLn1.o(.text+0x1c): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccToXLn1.o(.text+0x27): undefined reference to `ostream::operator<<(ostream
&(*)(ostream &))'
collect2: ld returned 1 exit status
[anoop@lonewolf:anoop]$ gcc -x c++ a.C -o /dev/null -lstdc++
[anoop@lonewolf:anoop]$
Hope this is exactly what you wanted.
Anoop
--
http://symonds.net/~anoop
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help