LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-14-2011, 09:20 PM   #1
HiredGun555
LQ Newbie
 
Registered: May 2007
Distribution: Ubuntu
Posts: 16

Rep: Reputation: 0
installing tcl/tk for use in c++


I have perl/tk installed and working. I tried using c++/tk and had to change the #include path in the headers to find the tk.h and tcl.h. I tried compiling a simple c++ program with g++ to test that the headers are correct. the line i type at console is:

g++ test.c cpptk.cc cpptkbase.cc -o test.bin

I fixed all previous errors, except for the following.

cpptkbase.cc: In constructor ‘<unnamed>::Interp::Interp()’:
cpptkbase.cc:36: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc:42: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc:48: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘void<unnamed>::do_eval(const std::string&)’:
cpptkbase.cc:86: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘int callbackHandler(void*, Tcl_Interp*, int, Tcl_Obj* const*)’:
cpptkbase.cc:196: warning: deprecated conversion from string constant to ‘char*’
cpptkbase.cc:212: error: reference to ‘exception’ is ambiguous
/usr/include/c++/4.4/exception:60: error: candidates are: class std::exception
/usr/include/boost/exception/exception.hpp:177: error: class boost::exception
cpptkbase.cc:212: error: expected type-specifier before ‘exception’
cpptkbase.cc:212: error: expected ‘)’ before ‘const’
cpptkbase.cc:212: error: expected ‘{’ before ‘const’
cpptkbase.cc:212: error: expected initializer before ‘)’ token
cpptkbase.cc: In function ‘std::string Tk::details::addLinkVar(int&)’:
cpptkbase.cc:255: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘std::string Tk::details::addLinkVar(double&)’:
cpptkbase.cc:272: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘std::string Tk::details::addLinkVar(std::string&)’:
cpptkbase.cc:297: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘int Tk::details::getResultLen()’:
cpptkbase.cc:380: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘T Tk::details::getResultElem(int) [with T = int]’:
cpptkbase.cc:397: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc:404: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘T Tk::details::getResultElem(int) [with T = double]’:
cpptkbase.cc:421: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc:428: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘T Tk::details::getResultElem(int) [with T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]’:
cpptkbase.cc:445: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In member function ‘std::string Tk::details::Command::invoke() const’:
cpptkbase.cc:467: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In member function ‘Tk::details::Expr:perator int() const’:
cpptkbase.cc:528: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In member function ‘Tk::details::Expr:perator double() const’:
cpptkbase.cc:545: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In member function ‘T Tk::details::Params::get(int) const [with T = int]’:
cpptkbase.cc:610: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’
cpptkbase.cc: In function ‘void Tk::deleteCallback(const std::string&)’:
cpptkbase.cc:695: error: invalid use of incomplete type ‘struct Tcl_Interp’
/usr/lib/perl5/Tk/pTk/tcl.h:456: error: forward declaration of ‘struct Tcl_Interp’

I checked the error in the file cpptkbase.cpp, but nothing is wrong. i'm using ubuntu 10.10 and the files i downloaded is:

cpptk.cc cpptk.h cpptkbase.cc cpptkbase.h cpptkoptions.x cpptkconstants.x

i'm stumped as to how to correct this error.
 
Old 03-15-2011, 03:49 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
cpptkbase.cc : Timestamp = February 2006.

May be use an older g++ : 'g++-3.3 test.c cpptk.cc cpptkbase.cc -o test.bin

Suggest : Add 'hardy' to /etc/apt/sources.list, and do :
sudo apt-get update && sudo apt-get install g++-3.3
Code:
deb http://76.73.4.58/ubuntu/ hardy-updates main
deb http://76.73.4.58/ubuntu/ hardy universe
deb http://security.ubuntu.com/ubuntu hardy-security main
deb http://security.ubuntu.com/ubuntu hardy-security universe
 
Old 03-15-2011, 09:12 PM   #3
HiredGun555
LQ Newbie
 
Registered: May 2007
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
i tried your suggestion, but still get the same errors. it says something about the forward declaration, but it looks fine to me. i'm still stumped by what it could be.
 
Old 11-08-2012, 04:34 AM   #4
javiss
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
Yesterday I have compiled (gcc 4.5.3 ) my test-example with success by the next code:

g++ example.cpp /downloads/cpptk-1.0.2/cpptk.cc /downloads/cpptk-1.0.2/base/cpptkbase.cc -ltcl -ltk -pthread -I/downloads/cpptk-1.0.2/ -o myprog

before it, i patched the line:212 of cpptkbase.cc: catch (exception const &e) -> catch (std::exception const &e)
all examples from cpptk were compiled with success too.

Tk is nice/

Last edited by javiss; 11-08-2012 at 04:40 AM.
 
1 members found this post helpful.
  


Reply

Tags
c++, cpptk, tcl, tk


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Tile for Tcl/Tk neophytezer0 Linux - Software 0 01-03-2008 07:14 AM
problems installing Tk (of Tcl/Tk) Arild2 Linux - Software 2 12-14-2007 11:58 PM
Cannot find Tcl dll ( Perl's Tcl bridge ) Xyem Linux - Software 2 08-08-2006 09:45 AM
Installing Tcl/Tk Quiber Suse/Novell 1 01-18-2005 10:08 AM
Installing tcl/tk on Mandrake 9.1 rish Mandriva 1 09-06-2003 11:41 PM


All times are GMT -5. The time now is 07:25 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration