what is problem of my code?

435
4
10-13-2011 06:29 PM
hexuezhou
New Contributor
int CreateFileGDB(std::wstring filegdbPath,std::wstring filegdbName,Geodatabase &newFGDB)
{
 fgdbError hr;
 wstring errorText;
 Geodatabase geodatabase;

 wstring fgdb;
 fgdb.empty();
 fgdb.append(filegdbPath);
 fgdb.append(L"/");
 fgdb.append(filegdbName);

 //Try to delete exist the same filegdb
 hr = DeleteGeodatabase(fgdb);
 if (hr == S_OK)
 {
  wcout << "Find the GDB exist,then the origin geodatabase has been deleted" << endl;
 }
 else if (hr == -2147024893)
 {
  wcout << "The geodatabase does not exist, no need to delete" << endl;
 }
 else
 {
  wcout << "An error occurred while deleting the geodatabase." << endl;
  ErrorInfo::GetErrorDescription(hr, errorText);
  wcout << errorText << "(" << hr << ")." << endl;
  return -1;
 }

 // Create a new geodatabase in the parameter Path.
 if ((hr = CreateGeodatabase(fgdb, geodatabase)) != S_OK)
 {
  wcout << "An error occurred while creating the geodatabase." << endl;
  ErrorInfo::GetErrorDescription(hr, errorText);
  wcout << errorText << "(" << hr << ")." << endl;
  return -1;
 }
 wcout << "The geodatabase has been created." << endl;
 newFGDB = geodatabase;
 return 0;
}


In this code the error exist in line "newFGDB = geodatabase".
the error is : IntelliSense: "FileGDBAPI::Geodatabase &FileGDBAPI::Geodatabase::operator=(const FileGDBAPI::Geodatabase &)" (code the line: 283,belong file: "F:\SoftWare\ArcGIS\FileGDB_API_VS2010_1_0Final\samples\..\include\Geodatabase.h")

thanks very much!
0 Kudos
4 Replies
VinceAngelo
Esri Esteemed Contributor
The 1.1 version of the FileGDB API was released back in August;  you probably want to try
using that before visiting the File Geodatabase API forum to ask further questions.

- V
0 Kudos
hexuezhou
New Contributor
Okay!
Thanks all the same!
0 Kudos
hexuezhou
New Contributor
#include <string>
#include <fstream>
#include <iostream>

#include <FileGDBAPI.h>
#include "CSchemas.h"

using namespace std;
using namespace FileGDBAPI;

int main()
{
 int iexecuteStatus;
 Geodatabase newFGDB;
 //1.Create File Geodatabase(path,name,gdb)
 iexecuteStatus =CreateFileGDB(L"C:/Temp",L"test1.gdb",newFGDB);
 if(iexecuteStatus!=0)
 {
  wcout<<L"create file geodatabase error!"<<endl;
  return -1;
 }

 return 0;
}

//Create File Geodatabase for Format Convertion
//Author: Hexz 
//CreateTime:2011-10-13 
//Version:1.0
//Revision:No
int CreateFileGDB(std::wstring filegdbPath,std::wstring filegdbName,Geodatabase& pnewFGDB)
{
 fgdbError hr;
 wstring errorText;
 Geodatabase geodatabase;

 wstring fgdb;
 fgdb.empty();
 fgdb.append(filegdbPath);
 fgdb.append(L"/");
 fgdb.append(filegdbName);

 //Try to delete exist the same filegdb
 hr = DeleteGeodatabase(fgdb);
 if (hr == S_OK)
 {
  wcout << "Find the GDB exist,then the origin geodatabase has been deleted" << endl;
 }
 else if (hr == -2147024893)
 {
  wcout << "The geodatabase does not exist, no need to delete" << endl;
 }
 else
 {
  wcout << "An error occurred while deleting the geodatabase." << endl;
  ErrorInfo::GetErrorDescription(hr, errorText);
  wcout << errorText << "(" << hr << ")." << endl;
  return -1;
 }

 // Create a new geodatabase in the parameter Path.
 if ((hr = CreateGeodatabase(fgdb, geodatabase)) != S_OK)
 {
  wcout << "An error occurred while creating the geodatabase." << endl;
  ErrorInfo::GetErrorDescription(hr, errorText);
  wcout << errorText << "(" << hr << ")." << endl;
  return -1;
 }
 wcout << "The geodatabase has been created." << endl;

 return 0;
}


I have used version1.1 ,but vs2010 show the same error!
as code paste in the thread.
could help  my code error?  Thanks
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Please ask in the appropriate Forum (after reviewing other similar posts).

- V
0 Kudos