Board index » cppbuilder » Problem calling a function from another unit.
nobody
CBuilder Developer |
Problem calling a function from another unit.2003-12-04 10:33:44 AM cppbuilder23 Hi, This has been troubling me for a couple of days. I want to call a function 'test()' (which has been coded in Unit2.c) from Unit1. I can email you an example program which causes the problem if nessecearry. Thanks in advance. When I compile I get an error message like this: [Linker Error] Unresolved external 'test()' referenced from C:\windows\desktop\test\unit1.obj =[file is unit1.c]================================================ #include <vcl.h> #pragma hdrstop #include "Unit1.h" #include "Unit2.h" //-------------------------------------------------------------------------- - #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //-------------------------------------------------------------------------- - __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //-------------------------------------------------------------------------- - void __fastcall TForm1::Button1Click(TObject *Sender) { test(); } //-------------------------------------------------------------------------- - =[file is unit2.c]==================================================== #include "Unit2.h" void test(void) { char i; i=1; i=i+1; } ==[file is unit2.h]=================================================== #ifndef Unit2_H_ #define Unit2_H_ void test(void); #endif |