If you want to call that function from other units you need to declare it like so in the form's unit file and leave the declaration you have made in the header file. You don't need to declare it in the header if only plan on calling the function in that unit. >(I have "AnsiString callFunction() " in the Public section of my header) ![]() I gave up on my project about a month ago becuase of this error but it gives me a little hope knowing the problem wasn't entirely me.īTW when I try ffFixed instead of AnsiString::sffFixed I get: This runs without any errors, but when I un-comment the call to the function (Label1Click event) is when I get the "UNRESOLVED EXTERNAL" Void _fastcall TForm1::Label1Click(TObjec t *Sender) Return (FloatToStrF(TotalNumberOf FreeBytes/ 1048576, ffFixed, 7, 2) + " MB") TotalNumberOfBytes, &TotalNumberOfFreeBytes) Sysutils::GetDiskFreeSpace Ex("c:\\", FreeBytesAvailableToCaller , _fastcall TForm1::TForm1(TComponent* Owner) (I have "AnsiString callFunction() " in the Public section of my header) I tried your example of Sysutils::GetDiskFreeSpace Ex: I think maybe there is a problem with my BCB. S.sprintf("%I64d percent of the space on drive 0 is free: %I64d KB", AmtFree*100/Total, AmtFree/1024 ) When the following code executes, it displays a message in the label indicating the number of KB free, and what percentage of the entire disk space that represents. This example uses a form with a label on it. Returns the number of free bytes on a specified drive.Įxtern PACKAGE _int64 _fastcall DiskFree(Byte Drive) ĭiskFree returns the number of free bytes on the specified drive, where 0 = Current, 1 = A, 2 = B, and so on.ĭiskFree returns -1 if the drive number is invalid. In anycase you don't have to create your own function BCB6 already has the one you need. Unit1.cpp(29): W8006 Initializing TFloatFormat with AnsiString::TStringFloatFo rmat The only message I get is a compiler warning pointing to this line I've created a totally new project and pasted your code into a new unit. ReturnDiskSpace = FloatToStrF(freeSpaceFlt, AnsiString::sffFixed, 7, 2) + " MB" Ĭan you post the order of the included headers you've declared? I don't get a unresolved external error with your function. _i64toa( *totalFreeSpace, tempFreeSpc, 10 ) įreeSpaceFlt = StrToFloat(tempFreeSpc) / 1000000 I know there are probably problems with this function so pls help me out. ![]() ![]() I get no errors other than the Unresolved External. Thanks.īTW here's the function I'm trying to use. Is the problem with the scope of Sysutils::GetFreeDiskSpace ? Unresolved external 'TMainForm::getTheDiskSpac e()' referenced from C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\C++\INSTALLER\UN IT1.OBJ When I try to use "Sysutils::GetDiskFreeSpac eEx" in one of my OWN functions, I get: then the rest converting, formatting, and displaying the result.īUT. Sysutils::GetDiskFreeSpace Ex( "C:", *freeSpace, *totalSpace, totalFreeSpace ) So I use "Sysutils::GetDiskFreeSpac eEx" and I get that to work fine with the following: I get the 'E2015 Ambiguity between '_stdcall GetDiskFreeSpaceEx.' and 'Sysutils::GetDiskFreeSpac eEx' ' when I try. I don't know how to utilize the GetDiskFreeSpaceEx API in Borland C++Builder 6. I am trying to make an installer and want to display a client's disk space on a fixed drive that they will locate in the app.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |