This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Building DLLs on C++ version code failed, but okay on C version code.
- From: "kenny at ca" <heqing dot gugle at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 4 Jul 2010 03:27:19 -0700 (PDT)
- Subject: Re: Building DLLs on C++ version code failed, but okay on C version code.
- References: <29068199.post@talk.nabble.com>
Forgot to attach error information.
hello.o:hello.cpp:(.text+0xd): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::size() const'
hello.o:hello.cpp:(.text+0x60): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::operator[](unsigned int) const'
hello.o:hello.cpp:(.text+0x9f): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::operator[](unsigned int) const'
hello.o:hello.cpp:(.text+0xce): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::operator[](unsigned int) const'
hello.o:hello.cpp:(.text+0x111): undefined reference to `std::cout'
hello.o:hello.cpp:(.text+0x116): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>
>&, char const*)'
hello.o:hello.cpp:(.text+0x11e): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>
>&)'
hello.o:hello.cpp:(.text+0x126): undefined reference to
`std::basic_ostream<char, std::char_traits<char>
>::operator<<(std::basic_ostream<char, std::char_traits<char> >&
(*)(std::basic_ostream<char, std::char_traits<char> >&))'
hello.o:hello.cpp:(.text+0x149): undefined reference to
`std::ios_base::Init::Init()'
hello.o:hello.cpp:(.text+0x164): undefined reference to
`std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status
kenny@ca wrote:
>
> 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?
>
>
--
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.-tp29068199p29068213.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