我有下面的代码,可以编译,但是当我运行它时,它会因为缺少资源而失败。我已经检查了级联安装程序和所有的点击和安装。我怎么才能解决这个问题?
#include <TDocStd_Application.hxx>
#include <TDataStd_Integer.hxx>
int main()
{
Handle(TDocStd_Application) app = new TDocStd_Application;
Handle(TDocStd_Document) doc;
app->NewDocument("BinOcaf", doc);
if (doc.IsNull())
{
std::cout << "Error: cannot create an OCAF document." << std::endl;
return 1;
}
// to access the main label, the transient data framework
TDF_Label mainLab = doc->Main();
// attach some integer value to this label
TDataStd_Integer::Set(mainLab, 1002);
// save document to file
PCDM_StoreStatus sstatus = app->SaveAs(doc, "C:/Users/Administrator/Desktop/test.cbf");
if (sstatus != PCDM_SS_OK)
{
app->Close(doc);
std::cout << "cannot write OCAF document." << std::endl;
return 1;
}
// release the data of doc
app->Close(doc);
return 0;
}发布于 2022-03-22 01:57:02
好吧,在挠头之后,我意识到了一件事。忘记定义格式了。只要将代码行添加到主函数中,就可以解决这个问题。
BinDrivers::DefineFormate(app);https://stackoverflow.com/questions/71555385
复制相似问题