This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: R: Building DLLs on C++ version code failed, but okay on C version code.


thank you all. You all are right. I got the desired dlls. Now I know I was
misleaded by the statement that GCC is a collection of compilers and it
automatically use a compiler according to a programming language.


Marco atzeri-3 wrote:
> 
> --- Dom 4/7/10, kenny@ca  ha scritto:
> 
>> 
>> Hi there,
>> 
>> I wrote a file, hello.c. It has only one function: print a
>> message like
>> "hello!". 
>> ##### hello.c #########
>> #include <stdio.h>
>> void hello() { printf( "Hello.\n" ) ; }
>> 
>> $gcc -c hello.c
>> $gcc -shared -o hello.dll hello.o
>> 
>> I successufully built it as DLL, hello.dll.
>> 
>> Then, I rewrote it in c++.
>> ##### hello.cpp #######
>> #include <iostream>
>> using namespace std ;
>> void hello() {cout << "Hello." << endl ;}
>> 
>> Then, I used the commands above to built DLL, but it
>> failed. Why did it
>> fail?
> 
> wrong compiler ? 
> For C++ you need a C++ compiler
> 
> $g++ -c hello.cpp
> $g++ -shared -o hello.dll hello.o
> 
> Marco
> 
> PS: this is not a cygwin issue, it is a "very" basic one.
> 
> 
>  
> 
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Building-DLLs-on-C%2B%2B-version-code-failed%2C-but-okay-on-C-version-code.-tp29068199p29073093.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]