Christiansen, Brad schrieb:
Hi,
I have searched the archive but cant find any mention of the problem,
though I think can remember reading about a solution some time ago on
the list.
I have just tried to build the static version of OSG v2.4 and v2.5.5
using ViualStudio .Net 2003. When I do this build I get 5000+ warnings
about dulpicate definitions when linking (LNK 4006). I then cannot link
my aplication against the resulting .libs. Has anyone else encountered
this problem and have a fix / workaround?
Are these link-errors related to OpenThreads? A quick and dirty fiy
would be:
change CMakeLists for all osg-libs/src from
IF (DYNAMIC_OPENSCENEGRAPH)
ADD_DEFINITIONS(-DOSG_LIBRARY)
ELSE (DYNAMIC_OPENSCENEGRAPH)
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ENDIF(DYNAMIC_OPENSCENEGRAPH)
to
IF (DYNAMIC_OPENSCENEGRAPH)
ADD_DEFINITIONS(-DOSG_LIBRARY)
ELSE (DYNAMIC_OPENSCENEGRAPH)
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ADD_DEFINITIONS(-DOT_LIBRARY_STATIC)
ENDIF(DYNAMIC_OPENSCENEGRAPH)
The underlying problem is:
The setting, that you compiled OpenThreads statically is not carried out
to a public header or something. If another lib includes a header-file
of OpenThreads the compiler thinks, that OpenThreads is linked for
dynamic-usage (because OT_LIBARY_STATIC is not defined so the
EXPORT-definition for OpenThreads is not setup correctly), so you'll get
multiple defined symbols, when you try to link your app with static
OpenThreads and static osg, because osg includes OpenThreads-symbols for
dynamic-linking.
IMHO the definition of OT_LIBARY_STATIC should be carried out to
OpenThreads/Config. The same should be done for OSG_LIBRARY_STATIC. On
Linux there's no such problem, because you don't have to declare
different exports for static versus dynamic linking.
I am no expert in CMake, so perhaps somebody may jump in here?
cheers,
Stephan
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org