mutiple template definitions when linking
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Fast/CGI |
New
|
Undecided
|
Unassigned |
Bug Description
Compiler: gcc-4.3.2
Platform: Ubuntu linux
Boost version: 1.43
When linking two separately compiled object files that both include <boost/fcgi.hpp>, the link fails with:
MenuModule.
Menu.o: In function `boost:
/usr/include/
etc....
The problem seems to be that fully specialized versions of template functions should be declared as inline. Not doing so causes a version to exist in each compilation unit.
I inlined the ones that seemed to be causing the linking problem.
e.g. in boost/cgi/
template<>
inline <------
void
basic_client<
:
>::handle_
That seemed to fix it.
There are a few more in that file which I also needed to inline. Probably there are others in other files but they have not caused me problems.
Best regards, Richard
P.S. This is a really cool library. Thanks for all your hard work.
Hi Richard,
Thanks for the report.
The test suite is currently missing an automated test for multiple
translation units, which is why this was missed. I tested this within the
last couple of months, so I think this should be the only broken class, but
I'll apply this fix and add a test case for it this evening / or tomorrow.
Cheers,
Darren
P.S. The launchpad site isn't kept up to date - http:// cgi.sf. net is the
main site for the library these days!
On 5 July 2010 13:32, Richard Forrest <email address hidden> wrote:
> Public bug reported: o:/usr/ include/ boost/cgi/ fcgi/client. hpp:157: first defined here :cgi::common: :basic_ client< boost:: cgi::common: :tags:: fcgi>:: handle_ write(unsigned system: :error_ code&)' : boost/cgi/ fcgi/client. hpp:157: multiple definition of :cgi::common: :basic_ client< boost:: cgi::common: :tags:: fcgi>:: handle_ write(unsigned system: :error_ code&)' fcgi/client. hpp ------- ------- - Added by me! CGI_NAMESPACE: :common: :tags:: fcgi write(std: :size_t bytes_transferred, boost:: system: :error_ code& /bugs.launchpad .net/bugs/ 601886
>
>
> Compiler: gcc-4.3.2
> Platform: Ubuntu linux
> Boost version: 1.43
>
>
> When linking two separately compiled object files that both include
> <boost/fcgi.hpp>, the link fails with:
>
> MenuModule.
> Menu.o: In function
> `boost:
> int, boost::
> /usr/include/
> `boost:
> int, boost::
>
> etc....
>
> The problem seems to be that fully specialized versions of template
> functions should be declared as inline. Not doing so causes a version to
> exist in each compilation unit.
>
> I inlined the ones that seemed to be causing the linking problem.
>
> e.g. in boost/cgi/
>
> template<>
> inline <------
> void
> basic_client<
> ::BOOST_
> >::handle_
> ec)
>
> That seemed to fix it.
>
> There are a few more in that file which I also needed to inline.
> Probably there are others in other files but they have not caused me
> problems.
>
> Best regards, Richard
>
> P.S. This is a really cool library. Thanks for all your hard work.
>
> ** Affects: cgi
> Importance: Undecided
> Status: New
>
> --
> mutiple template definitions when linking
> https:/
> You received this bug notification because you are the registrant for
> Fast/CGI.
>