Re: [greenstone-users] Can't compile local library code

From Michael Dewsnip
DateMon, 29 May 2006 10:13:19 +1200
Subject Re: [greenstone-users] Can't compile local library code
In-Reply-To (44730790-3060804-it-iitb-ac-in)
Hi,

You probably don't have some header files included. Try adding

#if defined (GSDL_USE_OBJECTSPACE)
#include <ospacestdiostream>
#include <ospacestdfstream>
#elif defined (GSDL_USE_IOS_H)
#include <iostream.h>
#include <fstream.h>
#else
#include <iostream>
#include <fstream>
#endif

at the top of fnord.cpp and recompiling.

Regards,

Michael

Chaitra wrote:

> Hi,
> I have inserted the following lines of code into w32server/fnord.cpp
> to download a zip file from server and unzip it on the local machine.
>
> //Creates a new thread for running an external command (in this a DOS
> command )
> void spawnProcess(char *cmdStr,DWORD timeout){
> STARTUPINFO si;
> PROCESS_INFORMATION pi;
> LPTSTR szCmdline=_tcsdup(TEXT(cmdStr));
> DWORD res;
> ZeroMemory( &si, sizeof(si) );
> si.cb = sizeof(si);
> ZeroMemory( &pi, sizeof(pi) );
> // Start the child process.
> if( !CreateProcess(NULL, //No module name (use command line)
> szCmdline, // Command line
> NULL, // Process handle not inheritable
> NULL, // Thread handle not inheritable
> FALSE, // Set handle inheritance to FALSE
> 0, // No creation flags
> NULL, // Use parent's environment block
> NULL, // Use parent's starting directory
> &si, // Pointer to STARTUPINFO structure
> &pi ) // Pointer to PROCESS_INFORMATION structure
> )
> {
> // printf( "CreateProcess failed (%d). ", GetLastError() );
> return;
> }
> // Wait until child process exits.
> res=WaitForSingleObject( pi.hProcess, timeout);
> if(res==WAIT_TIMEOUT){
> TerminateProcess(pi.hProcess,0);
> }
>
> // Close process and thread handles.
> CloseHandle( pi.hProcess );
> CloseHandle( pi.hThread );
>
> }
>
>
> /**
> * Function to create a batch file which calls the unzip utiltity
> * @param fileName name of the batch file to be created
> * The batch file creation is a workaround to the inability to run
> commands
> * such as cd \ from within a C++ program
> */
> void createBatchFile(char* fileName){
>
> //char *gsdlhome = "F:\greenstone\tmp\Test_CD\gsdl";
> char* gsdlhome = gsdl_gsdlhome.getcstr();
> ofstream out("test.bat");
> char* str1 = "wget -r -N -l inf -nr -nH -nd -c
> www.mlasia.iitb.ac.in/gsdl/collect.tar.tgz";
> char* str2 = "copy collect.tar.tgz Debug\collect";
> //char* str3 = "cd Debug\collect\";
> char* str3="cd tmp\Test_CD\gsdl\collect"
> char* str4 = "gunzip collect.tar.tgz";
> char* str5 = "tar -xvf collect.tar.tar";
> char* str6 = "del collect.tar.tar";
> char* str7 = "cd ..\..\";
> char* str8 = "del collect.tar.tgz";
> char* str9 = "del ";
> char* nline = "r ";
> char str[100], stri[300];
> strcpy(str,str1);
> strcat(str,nline);
> strcpy(stri,str);
> strcat(stri,str2);
> strcat(stri,nline);
> strcat(stri,str3);
> strcat(stri,nline);
> strcat(stri,str4);
> strcat(stri,nline);
> strcat(stri,str5);
> strcat(stri,nline);
> strcat(stri,str6);
> strcat(stri,nline);
> strcat(stri,str7);
> strcat(stri,nline);
> strcat(stri,str8);
> strcat(stri,nline);
> strcat(stri,str9);
> strcat(stri,fileName);
> cout << "stri : " << stri << " " ;
> out<<stri;
> out.close();
> return;
>
> }
>
>
> //This function creates a new button to update the library on the
> server (local library) interface
> int enter_update_library (HWND Window) {
> int res;
> char* filNam="test.bat";
> createBatchFile(filNam);
> spawnProcess("test.bat",INFINITE);
> return 0; // failed
> }
>
>
> The problem is that I'm unable to compile this code after integrating
> into the server code. I can compile it as a standalone module. It
> shows the following errors on compilation:
> C:Program FilesMicrosoft Visual StudioVC98includeostream.h(62) :
> error C2872: 'st
> reambuf' : ambiguous symbol
> C:Program FilesMicrosoft Visual StudioVC98includeostream.h(70) :
> error C2872: 'io
> s' : ambiguous symbol
> C:Program FilesMicrosoft Visual StudioVC98includeostream.h(70) :
> error C2872: 'io
> s' : ambiguous symbol
> C:Program FilesMicrosoft Visual StudioVC98includeostream.h(87) :
> error C2872: 'st
> reambuf' : ambiguous symbol
> C:Program FilesMicrosoft Visual StudioVC98includeostream.h(94) :
> error C2872: 'st
> reampos' : ambiguous symbol
> C:Program FilesMicrosoft Visual StudioVC98includeostream.h(95) :
> error C2872: 'st
> reamoff' : ambiguous symbol
> C:Program FilesMicrosoft Visual StudioVC98includeostream.h(96) :
> error C2872: 'st
> reampos' : ambiguous symbol
>
> I use Visual studio 6.0 for compiling the code.
>
> Please help! Thanks in advance.
>
> Regards,
> Chaitra
>
>
> _______________________________________________
> greenstone-users mailing list
> greenstone-users@list.scms.waikato.ac.nz
> https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>
>