Linking with BGL adjacency_list_io.hpp
Hi, I'm having trouble linking code that uses adjacency_list_io.hpp. If the header is included is included in more than one compilation unit, I get "multiple definition of function" errors for the non-template functions in adjacency_list_io.hpp: std::istream& operator >> ( std::istream& in, no_property& ) and void getSubset( no_property& p, const no_property& s ) I'm sure that there is some C+ subtlety that I'm missing here, but I'm not familiar enough with the library to understand what it is. Shouldn't non-template function code be in a .cpp file to keep this sort of thing from happening? - Solomon
Solomon,
I suspect they forgot to mark them inline. It would explain your problem.
Try changing them to ...
inline std::istream& operator >> ( std::istream& in, no_property& ) and
inline void getSubset( no_property& p, const no_property& s )
Best of luck,
Richard
----- Original Message -----
From: "Solomon Gibbs"
Hi,
I'm having trouble linking code that uses adjacency_list_io.hpp.
If the header is included is included in more than one compilation unit, I get "multiple definition of function" errors for the non-template functions in adjacency_list_io.hpp:
std::istream& operator >> ( std::istream& in, no_property& ) and void getSubset( no_property& p, const no_property& s )
I'm sure that there is some C+ subtlety that I'm missing here, but I'm not familiar enough with the library to understand what it is. Shouldn't non-template function code be in a .cpp file to keep this sort of thing from happening?
- Solomon
Info: http://www.boost.org Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
At 04:34 PM 7/29/2003, Richard Howells wrote:
Solomon,
I suspect they forgot to mark them inline. It would explain your problem. Try changing them to ...
inline std::istream& operator >> ( std::istream& in, no_property& ) and inline void getSubset( no_property& p, const no_property& s )
That was my thought too. Let us know if Richard's suggestion works so the source can be fixed. Thanks, --Beman
On Tuesday 29 July 2003 21:59, you wrote:
At 04:34 PM 7/29/2003, Richard Howells wrote:
Solomon,
I suspect they forgot to mark them inline. It would explain your problem. Try changing them to ...
inline std::istream& operator >> ( std::istream& in, no_property& ) and inline void getSubset( no_property& p, const no_property& s )
That was my thought too. Let us know if Richard's suggestion works so the source can be fixed.
Yes, thank you, that does seem to have been the problem. The suggested patch is attached. -Solomon [Non-text portions of this message have been removed]
...
[Non-text portions of this message have been removed]
Err, Sorry about that. Here are the relevant lines. *** adjacency_list_io.old Wed Jul 30 10:47:16 2003 --- adjacency_list_io.hpp Wed Jul 30 10:47:52 2003 *************** *** 67,73 **** return in; } ! std::istream& operator >> ( std::istream& in, no_property& ) { return in; } --- 67,73 ---- return in; } ! inline std::istream& operator >> ( std::istream& in, no_property& ) { return in; } *************** *** 109,115 **** get( p, s.m_value, Stag() ); } ! void getSubset ( no_property& p, const no_property& s ) { } --- 109,115 ---- get( p, s.m_value, Stag() ); } ! inline void getSubset ( no_property& p, const no_property& s ) { }
At 12:23 PM 7/30/2003, Solomon Gibbs wrote:
...
[Non-text portions of this message have been removed]
Err, Sorry about that. Here are the relevant lines.
*** adjacency_list_io.old Wed Jul 30 10:47:16 2003 --- adjacency_list_io.hpp Wed Jul 30 10:47:52 2003
...
Patched in CVS. Thanks, --Beman
participants (3)
-
Beman Dawes
-
Richard Howells
-
Solomon Gibbs