From: Marcelo M. <mm...@ac...> - 2006-02-16 15:40:52
|
Ingo Braun wrote: >Hello! > >SWIG version 1.3.28 should be able to handle namespaces. However I get a problem while linking the .o files into a shared lib. >---------------------------------------------------- >The interface file: >%module name >%{ >#include "name.h" >%} >---------------------------------------------------- >The h file: >namespace MyNameSpace { >int count; >} > > the header file above doesn't declare a variable, it defines it. hence, if you include the hedear file in two places (name.cpp and name_wrap.cpp), you will end with two symbols. Try using: namespace MyNameSpace { extern int count; } Marcelo >---------------------------------------------------- >The cpp file: >#include "name.h" >using namespace MyNameSpace; >count = 7; >---------------------------------------------------- > >I entered: > gcc -c name.cpp > /opt/swig-1.3.28/bin/swig -python -c++ name.i > gcc -c -I/opt/Python-2.4.2/include/python2.4/ name_wrap.cxx > gcc -shared name.o name_wrap.o -o _name.so >name_wrap.o(.bss+0x0): multiple definition of `MyNameSpace::count' >name.o(.bss+0x0): first defined here >collect2: ld returned 1 exit status > >Where is the multiple definition? Does anybody know this problem? Thank you very much. >Ingo >__________________________________________________________________________ >Erweitern Sie FreeMail zu einem noch leistungsstarkeren E-Mail-Postfach! >Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131 > > > >------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. Do you grep through log files >for problems? Stop! Download the new AJAX search engine that makes >searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 >_______________________________________________ >Swig-user mailing list >Swi...@li... >https://lists.sourceforge.net/lists/listinfo/swig-user > > |