C++/TCL Need Solution to Compile Error c2784
- From: JesusChuyCampos@xxxxxxxxx
- Date: 12 Apr 2007 00:24:04 -0700
I have a vendor (INTEG PG) that provides an SDK that includes
a .dll, .h and .lib file. Since I haven't program in C for over ten
years, I looked for a solution to repackage the DLL to be TCL
friendly. I was told to use CPPTCL. After reading their
documentation, it was ideal.
I will try to include all my notes. It may be an overkill, but I want
to share all that I have, so someone can replicate my results if they
decide to try it out.
The following is a list of SW used.
jnior 300 SDK - Provided by Integ PG with the CD that came with the
HW
TCL/TK - Downloaded from Activestate.com (version
ActiveTcl8.4.14.0.272572-win32-ix86-threaded.exe)
BOOST - Downloaded from http://www.boost.org/ (version
boost_1_33_1.zip)
CPPTCL - Downloaded from http://cpptcl.sourceforge.net/ (version
cpptcl-1.1.3.zip)
Microsoft Visual C++ Toolkit 2005 - Downloaded from
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
Note that CPPTCL requires this version of C++ Compilier because MS
Visual Studio 6 will not compile it.
For more information see http://cpptcl.sourceforge.net/ and here
http://wiki.tcl.tk/13040
How to install all the packages
I installed ActviceTCL C:\Program Files\Tcl and not C:\Tcl
I then created the following directory C:\Program Files\TCL_TK
I unzipped boost_1_33_1.zip in the C:\Program Files\TCL_TK directory I
unzipped cpptcl-1.1.3.zip in the C:\Program Files\TCL_TK directory I
created a sub-directory C:\Program Files\TCL_TK\integpg and copy the
jnior SDK files there which are the files that are in the D:
\jnior310\devel\Applications SDK\SDK Files\Windows DLL\dll
I Used the example from http://cpptcl.sourceforge.net/doc/quickstart.html
to test things out
I named the example file "hiworld.cpp" which I placed C:\Program Files
\TCL_TK\cpptcl-1.1.3
To compile I needed to do one step to set up environmental variables
Open a DOS Prompt
dosPrompt> cd C:\Program Files\Microsoft Visual Studio 8\Common7\Tools
source env file
dosPrompt> vsvars32.bat
verify env
dosPrompt> echo %PATH%
To Compile the hello world program, I did the following.
dosPrompt> cd C:\Program Files\TCL_TK\cpptcl-1.1.3
compile command
dosPrompt> "C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe"
hiworld.cpp cpptcl.cpp /EHs /I "C:/Program
Files/Tcl/include" /I "C:/Program Files/TCL_TK/boost_1_33_1" /I "C:/
Program Files/TCL_TK/cpptcl-1.1.3" /LD
"C:/Program Files/Tcl/lib/Tcl84.lib"
To test it out
dosPrompt> tclsh
tclPrompt> load hiworld.dll
tclPrompt> hi
Hello C++/Tcl!
It works!
tclPrompt> + 2 5
7
tclPrompt> exit
dosPrompt>
Before i attempt to create the TCL friendly DLL., I build a simple
program (using the SDK example) to make
sure I could compile using the jnior 310 SDK. Which worked! This test
did not use CPPTCL.
Now that I know things worked, I went ahead to build the TCL friendly
DLL for the jnior 310.
I also placed the file in C:\Program Files\TCL_TK\cpptcl-1.1.3 called
jnior310tcl.cpp
I took all the prototypes from the header file to build the calls,
needed within the CPPTCL_MODULE function
Example: jnior_300.h has the following prototypes
long __stdcall Connect(char *ip, unsigned short port, long *handle,
char *user_name, char *password);
which I used to create the following line
i.def("Connect", Connect);
To compile I use the following command and redirected the output
because of the amount of errors generated.
dosPrompt> "C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe"
jnior310tcl.cpp cpptcl.cpp /EHs /I
"C:/Program Files/Tcl/include" /I "C:/Program Files/TCL_TK/
boost_1_33_1" /I "C:/Program Files/TCL_TK/cpptcl-1.1.3"
/LD "C:/Program Files/Tcl/lib/Tcl84.lib" /LD "C:/Program Files/TCL_TK/
integpg/jnior300.lib" > error.txt
CODE FOR "hiworld.cpp"
==============================START
// Compile command
// "C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe"
hiworld.cpp cpptcl.cpp /EHs /I "C:/Program Files/Tcl/include" /I "C:/
Program Files/TCL_TK/boost_1_33_1" /I "C:/Program Files/TCL_TK/
cpptcl-1.1.3" /LD "C:/Program Files/Tcl/lib/Tcl84.lib" > error4.txt
#include "cpptcl.h"
#include <iostream>
#define _SCL_SECURE_NO_DEPRECATE
using namespace std;
extern "C"
{
__declspec(dllexport) int Hiworld_Init(Tcl_Interp* interp);
}
void hello() {
cout << "Hello C++/Tcl!\nIt works!" << endl;
}
int sum(int a, int b) {
return a + b;
}
CPPTCL_MODULE(Hiworld, i) {
i.def("hi", hello);
i.def("add",sum);
i.def("+",sum);
}
==============================STOP
CODE FOR "jnior310tcl2.cpp"
==============================START
//
// Compile command
// cd C:/Program Files/TCL_TK/cpptcl-1.1.3
// "C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe"
jnior310tcl2.cpp cpptcl.cpp /EHs /I "C:/Program Files/Tcl/include" /I
"C:/Program Files/TCL_TK/boost_1_33_1" /I "C:/Program Files/TCL_TK/
cpptcl-1.1.3" /I "C:/Program Files/TCL_TK/integpg" /LD "C:/Program
Files/Tcl/lib/Tcl84.lib" /LD "C:/Program Files/TCL_TK/integpg/
jnior300.lib" > error3.txt
//
#include "cpptcl.h"
#include "jnior_300.h"
#include <iostream>
using namespace std;
#define _SCL_SECURE_NO_DEPRECATE
extern "C"
{
__declspec(dllexport) int Jnior300tcl_Init(Tcl_Interp* interp);
}
CPPTCL_MODULE(Jnior300tcl, i) {
// i.def("GetDLLVersion", GetDLLVersion);
// Socket Connection
// i.def("queryForPort", queryForPort);
i.def("Connect", Connect);
// i.def("Disconnect", Disconnect);
// i.def("GetUserID", GetUserID);
// i.def("SetRetryCount", SetRetryCount);
}
==============================STOP
ERROR MESSAGE
==============================START
jnior310tcl2.cpp
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6,T7,T8,T9),const
Tcl::policies &)' : could not deduce template argument for 'overloaded
function type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(570) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6,T7,T8,T9),const
Tcl::policies &)' : could not deduce template argument for 'overloaded
function type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(570) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6,T7,T8),const
Tcl::policies &)' : could not deduce template argument for 'overloaded
function type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(558) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6,T7,T8),const
Tcl::policies &)' : could not deduce template argument for 'overloaded
function type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(558) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6,T7),const Tcl::policies
&)' : could not deduce template argument for 'overloaded function
type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(547) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6,T7),const Tcl::policies
&)' : could not deduce template argument for 'overloaded function
type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(547) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6),const Tcl::policies
&)' : could not deduce template argument for 'overloaded function
type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(537) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5,T6),const Tcl::policies
&)' : could not deduce template argument for 'overloaded function
type' from 'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(537) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5),const Tcl::policies &)' :
could not deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(527) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4,T5),const Tcl::policies &)' :
could not deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(527) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4),const Tcl::policies &)' :
could not deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(517) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3,T4),const Tcl::policies &)' :
could not deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(517) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3),const Tcl::policies &)' : could
not deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(508) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2,T3),const Tcl::policies &)' : could
not deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(508) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2),const Tcl::policies &)' : could not
deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(499) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1,T2),const Tcl::policies &)' : could not
deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(499) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1),const Tcl::policies &)' : could not
deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(490) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(T1),const Tcl::policies &)' : could not
deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(490) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(void),const Tcl::policies &)' : could not
deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(481) : see
declaration of 'Tcl::interpreter::def'
jnior310tcl2.cpp(28) : error C2784: 'void Tcl::interpreter::def(const
std::string &,R (__cdecl *)(void),const Tcl::policies &)' : could not
deduce template argument for 'overloaded function type' from
'overloaded function type'
c:\program files\tcl_tk\cpptcl-1.1.3\cpptcl.h(481) : see
declaration of 'Tcl::interpreter::def'
cpptcl.cpp
Generating Code...
==============================STOP
As you can see the only error I'm getting is this C2784 with the
message:
"could not deduce template argument for 'overloaded function type'
from 'overloaded function type'"
Any help is greatly appreciated.
-Jesus
.
- Follow-Ups:
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: Helmut Giese
- Re: C++/TCL Need Solution to Compile Error c2784
- Prev by Date: Re: [8.4.13] Tcl_CreateObjTrace - strange command level and order
- Next by Date: Re: Ann: Picol 0.1.10
- Previous by thread: Why Tcl/Tk does not have a 64-bit distribution?
- Next by thread: Re: C++/TCL Need Solution to Compile Error c2784
- Index(es):