|
Boost : |
From: Andrew Favell (andyfavell_at_[hidden])
Date: 2004-09-03 11:35:27
Ive been using Boosts serialization library with MSVC 7.1 (the first time that Ive used it). For most of my project I put the load / save function declaration in the class header (the .h file) and the definitions in the .cpp file VC 7.1 allows this for templated functions, unlike some older compilers. In debug mode this compiled and linked fine except for abstract base classes through trial and error I found that for abstract classes the functions had to be defined in the .h file to avoid linker errors.
My project built fine in Debug mode and I then tried to compile / link it in Release mode this threw up quite a few LNK2001 errors relating to just a few of the serialization load / save functions in just some of the classes most of the classes that declared the load / save functions evidently linked fine (as they all did in Debug mode). After much double checking of the compile / link project configurations I tried the following:
1. I removed the BOOST_CLASS_EXPORT(etc) declaration at the bottom of the .h files in which the load / save functions were not linking. On recompiling / linking most of the linker errors were gone, but a few remained.
2. For the remaining classes that were not still not linking, I moved the load / save functions from the .cpp file into the .h file (these were not abstract classes). This fixed the remaining linker errors and my application compiled / linked / ran fine.
I can't see why this occurred. I havent checked yet (its very time consuming to rebuild this application) but possibly option (2) would have worked for all the affected classes. For most of this project, the load / save functions remain defined in the .cpp file and clearly link fine in both debug and release configurations. Before someone asks, I did complete clean / rebuilds for both configurations anybody any ideas?
andy :-)
-- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk