Reputation:
I have a routine in C++ Builder 6 that send a file to webserver via HTTP Post, and when compile the project show these error messages from Linker:
[Linker Error] Unresolved external"__fastcall Idmultipartformdata::TIdMultipartFormDataStream()" referenced from C:\Users\Admin\Documents\ProjCB6\Unit1.obj.
Then; How I can do for resolved this problem? Thanks in advance!
Here leave used source code =>
void HTTP()
{
TStringStream *response=new TStringStream("");
TIdMultiPartFormDataStream *stream=new TIdMultiPartFormDataStream();
TIdHTTP *IdHTTP1 = new TIdHTTP(NULL);
try
{
IdHTTP1->Request->ContentType=stream->RequestContentType;
stream->AddFormField("file1","doc");
stream->AddFile("file1","c:\\3.doc","doc");
stream->Position = 0;
IdHTTP1->Post("http://172.16.8.186/doc/up.php",stream,response);
Memo1->Lines->LoadFromStream(response);
response->Free();
stream->Free();
IdHTTP1->Free();
}
catch(...)
{
response->Free();
stream->Free();
IdHTTP1->Free();
}
}
Upvotes: 0
Views: 3009
Reputation: 595339
C++Builder 6 shipped with Indy 8. TIdMultipartFormDataStream
was introduced in Indy 9. The fact that your code compiles at all means that your project is using Indy 9 or Indy 10 header files, but the project might have a reference to the older Indy 8 package instead of the nwer Indy 9/10 package(es). Make sure that you have completely wiped out Indy 8 from your BCB6 installation if you have upgraded to Indy 9 or later, and also make sure that your project contains references to the correct Indy package(s) for that version of Indy.
Upvotes: 1