TLIB mit dem Borland freeware compiler
-
Ich moechte eine Bibliothek erstellen. Meinen Quellcode uebersetzt der Compiler in eine obj-Datei. TLIB erstellt auch dann daraus eine lib-Bibliothek, aber die zugehoerige Header-Datei fehlt. Weis jemand, was ich falsch mache?
meine Befehle:
bcc32 -c Test.c
tlib libtest.lib+-Test.obj
-
Bitfresser_ST schrieb:
Ich moechte eine Bibliothek erstellen. Meinen Quellcode uebersetzt der Compiler in eine obj-Datei. TLIB erstellt auch dann daraus eine lib-Bibliothek, aber die zugehoerige Header-Datei fehlt. Weis jemand, was ich falsch mache?
Die Headerdatei mußt du dir selbst machen. (Woher soll TLIB denn wissen, welche Funktionen etc. du publik machen willst?)
-
aehm, und wie macht man das?
-
Bitfresser_ST schrieb:
aehm, und wie macht man das?
Windows-Explorer, Rechtsklick | Neu | Textdatei, Namen + ".h" oder ".hpp" eingeben, Enter drücken.
Mal im Ernst: Du hast eine .cpp-Datei. Dort stehen Funktionen und Klassen drin, die du auch anderen Programmen zugänglich machen willst. Also nimmst du folgende Aufteilung vor:Ursprüngliche .cpp-Datei (so etwa):
class class1 // muß in Header-Datei { private: int i; public: int get_i (void); double get_another_val (double diff = 0); }; int class1::get_i (void) // muß in Sourcedatei { return (i); } double class1::get_another_val (double diff) // dito { return (i * 40.0 + diff); } double my_func (int i) // muß in Sourcedatei; Headerdatei braucht aber einen Prototyp { return (i / 40.0); }
myfile.hpp:
class class1 { private: int i; public: int get_i (void); double get_another_val (double diff = 0); }; double my_func (int i); // Prototyp
myfile.cpp:
#include "myfile.hpp" int class1::get_i (void) { return (i); } double class1::get_another_val (double diff) { return (i * 40.0 + diff); } double my_func (int i) { return (i / 40.0); }
Moritz