Sun, 05/15/2022 - 10:35
Forums:
I wanted to add the function that import step file and export xmlocaf file in webgl demo. Add Include Files:
#include <STEPCAFControl_Reader.hxx>
#include <TDocStd_Document.hxx>
#include <BinDrivers.hxx>
#include <TDocStd_Application.hxx>
#include <XmlDrivers.hxx>
The Code:
Handle(TDocStd_Application) App=new TDocStd_Application();
XmlDrivers::DefineFormat(App);
Handle(TDocStd_Document) Doc=new TDocStd_Document("XmlOcaf");
STEPCAFControl_Reader Reader;
STEPControl_Reader StepReader = Reader.Reader();
StepReader.ReadStream(theName.c_str(), aStream);
Reader.Transfer(Doc);
std::ostringstream str;
App->SaveAs(Doc,str);
ConsoleLog(str.str());
When building,the make program throwed errors:
Linking CXX executable occt-webgl-sample.js
wasm-ld: error: duplicate symbol: PLUGINFACTORY
>>> defined in D:/Download/emsdk-main/upstream/emscripten/cache/sysroot/lib/libTKXml.a(XmlDrivers.cxx.o)
>>> defined in D:/Download/emsdk-main/upstream/emscripten/cache/sysroot/lib/libTKXmlL.a(XmlLDrivers.cxx.o)
Are there some functions that can't be used in WebGL?
Sun, 05/15/2022 - 11:46
These PLUGINFACTORY symbols shouldn't appear in libraries unless you've built OCCT without BUILD_LIBRARY_TYPE="Static" option.
Sun, 05/15/2022 - 17:47
Hi~Kirill Gavrilov.
Thanks for your reply!
I am sure that the
BUILD_LIBRARY_TYPE
parameter is set withStatic
when building OCCT Static Libraries.If we remove the include file and the code such as:
the make program will build successfully.