あなたはTCL/Tkのmanually from sourcesをコンパイルするか、単にinstall it from ActiveStateすると、あなたのTCL/Tkのインストールフォルダに次のような構造を得る:TCLとTKに、デフォルトの `.tcl`言語ファイルをローカルで検索する方法を教えてください。
+- bin
+- tcl85.dll
+- tk85.dll
//...
+- lib/
+- tcl8.5/
//All TCL files (.tcl)
+- tk8.5/
//All TK files (.tcl)
//...
だから、あなたはあなたのいくつかのアプリをコンパイルし、DLLのことをTCLとTK DLLのにリンクする場合Tham(DLLの)ディレクトリ../lib/tk8.5および../lib/tcl8.5に関連するすべてのTCL/TKファイルを検索します。これにより、エンドユーザーにTCLとTKをインストールさせる必要がなく、アプリを配布することが非常に難しくなります。
私のC++アプリケーションを配布したいです。
デフォルトのGUIレイアウトにはCPPTKを使用します。
私は、エンドユーザーがTCLとTKをインストールする必要がないようにしたいと考えています。私は彼らにextras/TCL
とextras/TK
のような私のアプリからの相対的なディレクトリにあるTKとTCL .TCL
ソースファイルのフォルダを提供したいと思います。 TKとTCL DLLのソースファイルフォルダの場所を教えてください。それを行うためのTKおよびTCL API関数名は何ですか?そのための特別なcpptk関数はありますか?
更新 だから私は、次のフォルダ構造とDonal Fellows answerを試してみました。
のように私のコードを見app/
+- app.exe
+- tcl85.dll
+- tk85.dll
+- extras/
+- tcl/
//All TCL files you can find in TCL install folder/ lib/tcl8.5
+- tk/
//All TK files you can find in TCL install folder/ lib/tk8.5
:それはcpptkbase.ccところで
のライン36にfailesに過ぎずコンパイル
#include <stdio.h>
#include "cpptk/cpptk.h"
using namespace Tk;
int main(int, char *argv[])
{
static char* str = "set extrasDir [file dirname [info nameofexecutable]]/extras\n"
"# Now use it to load some code...\n"
"source $extrasDir/tcl/init.tcl\n"
"# Another way to load code, using all *.tk files from a directory:\n"
"foreach tkFile [glob -nocomplain -directory $extrasDir/tk *.tk] {\n"
" source $tkFile\n"
"}\n";
// This next part is in a function or method...
//std::string script("the script to evaluate goes here");
std::string result = Tk::details::Expr(str,true); // I think this is correct
std::cout<< result << std::endl;
std::cin.get();
Tk::init(argv[0]);
button(".b") -text("Say Hello");
pack(".b") -padx(20) -pady(6);
Tk::runEventLoop();
std::cin.get();
}
:あなたが含まれているディレクトリを持っている場合、私はthis html\js app to get char string.
なぜこの質問は「c」とタグ付けされていますか? –
TclとTKにはC++で使用しているC++があります – Rella
しかし、あなたの質問はC++についてです。 –