Issue while creating a .dll file for a C++ program file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue while creating a .dll file for a C++ program file

Harika Parakala
Hello Sir/Madam,

I was using swig in the process of integrating R with TCL. I am new to Swig but learnt through documents provided. 

I am trying to execute a C++ program using SWIG on Windows 10. Using command prompt. I am not using Visual Studio I am basically trying to run r_cpp using C++ MinGW from TCL

I used the following commands to execute and error was thrown. I also have libtcl.dll in my MinGW lib path.

Please help me in fixing the issue.



C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>swig -c++ -tcl example.i

C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>g++ -c example.cxx

C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>g++ -c example_wrap.cxx -I/Tcl/include/tcl8.6

C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>g++ -shared example.o example_wrap.o -L/MinGW/lib -o example.so
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible /MinGW/lib/libmingw32.a when searching for -lmingw32
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible /MinGW/lib\libpthread.a when searching for -lpthread
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible /MinGW/lib/libuser32.a when searching for -luser32
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible /MinGW/lib\libuser32.a when searching for -luser32
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible /MinGW/lib/libkernel32.a when searching for -lkernel32
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible /MinGW/lib\libkernel32.a when searching for -lkernel32
example_wrap.o:example_wrap.cxx:(.text+0xc70): undefined reference to `__imp_Tcl_ResetResult'
example_wrap.o:example_wrap.cxx:(.text+0xc84): undefined reference to `__imp_Tcl_SetObjResult'
example_wrap.o:example_wrap.cxx:(.text+0xca5): undefined reference to `__imp_Tcl_SetErrorCode'
example_wrap.o:example_wrap.cxx:(.text+0xccd): undefined reference to `__imp_Tcl_ResetResult'
example_wrap.o:example_wrap.cxx:(.text+0xcee): undefined reference to `__imp_Tcl_SetErrorCode'
example_wrap.o:example_wrap.cxx:(.text+0xd19): undefined reference to `__imp_Tcl_AppendResult'
example_wrap.o:example_wrap.cxx:(.text+0xd49): undefined reference to `__imp_Tcl_NewStringObj'
example_wrap.o:example_wrap.cxx:(.text+0xd6e): undefined reference to `__imp_Tcl_ObjSetVar2'
example_wrap.o:example_wrap.cxx:(.text+0xe12): undefined reference to `__imp_Tcl_InitHashTable'
example_wrap.o:example_wrap.cxx:(.text+0xeeb): undefined reference to `__imp_Tcl_DeleteHashEntry'


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Issue while creating a .dll file for a C++ program file

Martin Siggel
Looks like you forgot to link the TCL library in your 4. step. Since
you are creating a shared library, linking dependent libraries is
required.

2017-03-15 18:08 GMT+01:00 Harika Parakala <[hidden email]>:

> Hello Sir/Madam,
>
> I was using swig in the process of integrating R with TCL. I am new to Swig
> but learnt through documents provided.
>
> I am trying to execute a C++ program using SWIG on Windows 10. Using command
> prompt. I am not using Visual Studio I am basically trying to run r_cpp
> using C++ MinGW from TCL
>
> I used the following commands to execute and error was thrown. I also have
> libtcl.dll in my MinGW lib path.
>
> Please help me in fixing the issue.
>
>
>
> C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>swig -c++ -tcl example.i
>
> C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>g++ -c example.cxx
>
> C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>g++ -c example_wrap.cxx
> -I/Tcl/include/tcl8.6
>
> C:\swigwin-3.0.12\swigwin-3.0.12\Examples\r\class>g++ -shared example.o
> example_wrap.o -L/MinGW/lib -o example.so
> C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:
> skipping incompatible /MinGW/lib/libmingw32.a when searching for -lmingw32
> C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:
> skipping incompatible /MinGW/lib\libpthread.a when searching for -lpthread
> C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:
> skipping incompatible /MinGW/lib/libuser32.a when searching for -luser32
> C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:
> skipping incompatible /MinGW/lib\libuser32.a when searching for -luser32
> C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:
> skipping incompatible /MinGW/lib/libkernel32.a when searching for -lkernel32
> C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:
> skipping incompatible /MinGW/lib\libkernel32.a when searching for -lkernel32
> example_wrap.o:example_wrap.cxx:(.text+0xc70): undefined reference to
> `__imp_Tcl_ResetResult'
> example_wrap.o:example_wrap.cxx:(.text+0xc84): undefined reference to
> `__imp_Tcl_SetObjResult'
> example_wrap.o:example_wrap.cxx:(.text+0xca5): undefined reference to
> `__imp_Tcl_SetErrorCode'
> example_wrap.o:example_wrap.cxx:(.text+0xccd): undefined reference to
> `__imp_Tcl_ResetResult'
> example_wrap.o:example_wrap.cxx:(.text+0xcee): undefined reference to
> `__imp_Tcl_SetErrorCode'
> example_wrap.o:example_wrap.cxx:(.text+0xd19): undefined reference to
> `__imp_Tcl_AppendResult'
> example_wrap.o:example_wrap.cxx:(.text+0xd49): undefined reference to
> `__imp_Tcl_NewStringObj'
> example_wrap.o:example_wrap.cxx:(.text+0xd6e): undefined reference to
> `__imp_Tcl_ObjSetVar2'
> example_wrap.o:example_wrap.cxx:(.text+0xe12): undefined reference to
> `__imp_Tcl_InitHashTable'
> example_wrap.o:example_wrap.cxx:(.text+0xeeb): undefined reference to
> `__imp_Tcl_DeleteHashEntry'
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Swig-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swig-user
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user