Modify

Opened 8 years ago

Closed 7 years ago

#3501 closed Bugs (fixed)

Reusing concepts from different compile units yields multiple defined symbols

Reported by: christoph.heindl@… Owned by: guwi17
Milestone: Boost 1.41.0 Component: uBLAS
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

Currently I use the ublas concepts defined in ublas/detail/concepts.hpp to derive concepts based on ublas concepts such as

template<class X> struct Vector : boost::numeric::ublas::VectorConcept?<X> {};

In my unit test project I have different compile units that use BOOST_CONCEPT_ASSERT to assure Vector concept compliance. This yields multiple defined symbols for the following methods (and full specialized versions):

ublas/detail/concepts.hpp: void concept_checks(); template<class T> ZeroElement?(T); template<class T> OneElement?(T);

inlining those solves the problem (for me). I'm compiling on MSVC9.0. Current trunk seems to have this methods still not-inlined.

Attachments (0)

Change History (11)

comment:1 Changed 8 years ago by guwi17

(In [56578]) see #3501: Reusing concepts from different compile units yields multiple defined symbols

  • added BOOST_UBLAS_INLINE macros to requested locations

comment:2 Changed 8 years ago by guwi17

  • Status changed from new to assigned

@Christoph: please check if the committed version fixes your problem. If not, please provide a small example to reproduce the problem.

comment:3 Changed 8 years ago by anonymous

@Gunter Committed version fixes my problem. I did not test on a fresh trunk checkout. All I did was replacing concepts.hpp of 1.39.0 by current head revision. Thanks for your help.

comment:4 Changed 8 years ago by guwi17

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [56614]) fix #3499 and fix #3501:

  • added inline to free helper functions
  • added missing concept check
  • fixed broken internal checks

comment:5 Changed 8 years ago by christoph.heindl@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

Hi Gunter,

I fear we need to reopen the bug. In Debug the same linker error as reported occurs because BOOST_UBLAS_INLINE is not defined to inline at all.

Therefore I suggest attributing the free functions with inline explicitely, unless someone knows a better solution.

best regards, Christoph

comment:6 Changed 8 years ago by anonymous

In config.hpp you can find the lines

#ifdef NDEBUG

#ifndef BOOST_UBLAS_INLINE
#define BOOST_UBLAS_INLINE inline
#endif
...

This means that inline is disabled in debug builds in order to be able to follow the execution path. Explicitely defining

#define BOOST_UBLAS_INLINE inline

before including any uBLAS header should solve the problem.

comment:7 Changed 8 years ago by christoph.heindl@…

It would solve the problem indeed.

I wonder, however, if requiring the user to do the bugfixing for a third-party library in his code is the best way to handle this.

comment:8 Changed 8 years ago by guwi17

(In [57202]) see #3501: Reusing concepts from different compile units yields multiple defined symbols (Incomplete)

  • removed inlines that were added with the last commit
  • added anonymous namespace to make functions local to compilation unit

comment:9 Changed 8 years ago by guwi17

(In [57208]) see #3501: Reusing concepts from different compile units yields multiple defined symbols (Incomplete)

  • updated documentation

comment:10 Changed 7 years ago by guwi17

(In [61114]) see #3501: moved release note entry to correct release

comment:11 Changed 7 years ago by guwi17

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [61115]) fix #3501: merge changes 57202,57208,61114 into release

boost/numeric/ublas/detail/concepts.hpp libs/numeric/ublas/doc/release_notes.htm

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain guwi17.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.