MSVS linking error while building C++ extension

Hi,

I am trying to build C++ wxPython extension using MSVS, I ended up
with linking error:

...
vertex.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) pu
blic: __thiscall wxString::~wxString(void)" (__imp_??1wxString@@QAE@XZ)
....

I used binaries from

http://www.wxpython.org/download.php#binaries

and swig from

http://wxpython.wxcommunity.com/tools/

Thanks for any hits in advance!

Best regards, Martin

->

See

C:\OSGeo4W\usr\src\releasebranch_6_4\gui\wxpython\vdigit>python
setup.py build_ext -D WXUSINGDLL -I
C:\OSGeo4W\include\grass;C:\OSGeo4W\usr\src\releasebranch_6_4\dist.i686-pc-mingw32\include;c:\src\osgeo\wxPython-2.8.9.2\lib\vc_dll\mswuh;c:\src\osgeo\wxPython-2.8.9.2\lib\vc_dll\mswh;c:\src\osgeo\wxPython-2.8.9.2\include;c:\src\osgeo\wxPython-2.8.9.2\include\wx\wxPython
-L C:\OSGeo4W\usr\src\releasebranch_6_4\dist.i686-pc-mingw32\lib;c:\src\osgeo\wxPython-2.8.9.2\lib\vc_dll

running build_ext
building '_grass6_wxvdigit' extension
swigging grass6_wxvdigit.i to grass6_wxvdigit_wrap.cpp
C:\OSGeo4W\apps\swig-wx\swig.exe -python -c++ -shadow -o grass6_wxvdigit_wrap.cp
p grass6_wxvdigit.i
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox
/MD /W3 /GX /DNDEBUG -DWXUSINGDLL=1 -IC:\OSGeo4W\include\grass -IC:\OSGeo4W\usr
\src\releasebranch_6_4\dist.i686-pc-mingw32\include -Ic:\src\osgeo\wxPython-2.8.
9.2\lib\vc_dll\mswuh -Ic:\src\osgeo\wxPython-2.8.9.2\lib\vc_dll\mswh -Ic:\src\os
geo\wxPython-2.8.9.2\include -Ic:\src\osgeo\wxPython-2.8.9.2\include\wx\wxPython
-IC:\OSGeo4W\apps\Python25\include -IC:\OSGeo4W\apps\Python25\PC /Tpgrass6_wxvd
igit_wrap.cpp /Fobuild\temp.win32-2.5\Release\grass6_wxvdigit_wrap.obj /GR
grass6_wxvdigit_wrap.cpp
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\link.exe /DLL /nologo
/INCREMENTAL:NO /LIBPATH:C:\OSGeo4W\usr\src\releasebranch_6_4\dist.i686-pc-ming
w32\lib /LIBPATH:c:\src\osgeo\wxPython-2.8.9.2\lib\vc_dll /LIBPATH:C:\OSGeo4W\ap
ps\Python25\libs /LIBPATH:C:\OSGeo4W\apps\Python25\PCBuild /EXPORT:init_grass6_w
xvdigit build\temp.win32-2.5\Release\cats.obj build\temp.win32-2.5\Release\drive
r.obj build\temp.win32-2.5\Release\driver_draw.obj build\temp.win32-2.5\Release\
driver_select.obj build\temp.win32-2.5\Release\line.obj build\temp.win32-2.5\Rel
ease\message.obj build\temp.win32-2.5\Release\select.obj build\temp.win32-2.5\Re
lease\undo.obj build\temp.win32-2.5\Release\vertex.obj build\temp.win32-2.5\Rele
ase\pseudodc.obj build\temp.win32-2.5\Release\digit.obj build\temp.win32-2.5\Rel
ease\grass6_wxvdigit_wrap.obj /OUT:build\lib.win32-2.5\_grass6_wxvdigit.pyd /IMP
LIB:build\temp.win32-2.5\Release\_grass6_wxvdigit.lib
   Creating library build\temp.win32-2.5\Release\_grass6_wxvdigit.lib and object
build\temp.win32-2.5\Release\_grass6_wxvdigit.exp
vertex.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) pu
blic: __thiscall wxString::~wxString(void)" (__imp_??1wxString@@QAE@XZ)
pseudodc.obj : error LNK2001: unresolved external symbol "__declspec(dllimport)
public: __thiscall wxString::~wxString(void)" (__imp_??1wxString@@QAE@XZ)
digit.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) pub
lic: __thiscall wxString::~wxString(void)" (__imp_??1wxString@@QAE@XZ)

···

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Martin Landa wrote:

Hi,

I am trying to build C++ wxPython extension using MSVS, I ended up
with linking error:

...
vertex.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) pu
blic: __thiscall wxString::~wxString(void)" (__imp_??1wxString@@QAE@XZ)
....

I used binaries from

Redirecting...

and swig from

NameBright - Coming Soon

Thanks for any hits in advance!

You are telling it where to find the libs, but not telling it which libs to link with.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi,

···

2009/5/9 Robin Dunn <robin@alldunn.com>:

Thanks for any hits in advance!

You are telling it where to find the libs, but not telling it which libs to
link with.

ops, my bad, I completely overlooked that, shame on me... :wink:

Anyway I ended up in the hell of mixing libraries compiled using MSVS
and Mingw... Is it possible to download somewhere binaries of wxPython
compiled with Mingw or I need to compile it on my own?

Thanks! Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Hi,

You are telling it where to find the libs, but not telling it which libs to
link with.

when trying to compile the extension with MSVS I get

vertex.obj : error LNK2001: unresolved external symbol "private:
static int wxDebugContextDumpDelayCounter::sm_count"
(?sm_count@wxDebugContextDumpDelayCounter@@0HA)

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c
/nologo /Ox /MD /W3 /GX /DNDEBUG -DPACKAGE="grasslibs" -D__WXMSW__
-Ic:\osgeo4w\usr\src\releasebranch_6_4\dist.i686-pc-mingw32\include
-I/c/OSGeo4W/include -Ic:\src\osgeo\wxPython-2.8.9.2\include
-Ic:\src\osgeo\wxPython-2.8.9.2\lib\vc_dll\mswuh
-Ic:\src\osgeo\wxPython-2.8.9.2\lib\vc_dll\mswh
-Ic:\src\osgeo\wxPython-2.8.9.2\include\wx\wxPython
-Ic:\osgeo4w\include\grass -IC:\OSGeo4W\apps\Python25\include
-IC:\OSGeo4W\apps\Python25\PC /Tpvertex.cpp
/FoOBJ.i686-pc-mingw32\Release\vertex.obj /GR
vertex.cpp

I wonder why - I didn't use __WX_DEBUG__ macro.

Thanks, Martin

···

2009/5/9 Robin Dunn <robin@alldunn.com>:

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Martin Landa wrote:

Hi,

Thanks for any hits in advance!

You are telling it where to find the libs, but not telling it which libs to
link with.

ops, my bad, I completely overlooked that, shame on me... :wink:

Anyway I ended up in the hell of mixing libraries compiled using MSVS
and Mingw... Is it possible to download somewhere binaries of wxPython
compiled with Mingw or I need to compile it on my own?

You'll need to compile it on your own, and it may take some tweaking of setup.py/config.py to do it.

···

2009/5/9 Robin Dunn <robin@alldunn.com>:

--
Robin Dunn
Software Craftsman