NVIDIA-Omniverse / usd-plugin-samples

USD schema extension samples, build tools, and sample kit extensions that use those schema extensions
Apache License 2.0
65 stars 6 forks source link

error LNK2019: unresolved external symbol #17

Closed ThaiLe-gt closed 2 weeks ago

ThaiLe-gt commented 3 weeks ago

I am trying to build a custom schema that inherits </ Xform> instead of inheriting</ Type>. However, I got an error while building that schema. I also have read this issue but it didn't work in my case LNK2019

System Information:

My custom schema

#usda 1.0
(
    subLayers = [
        @usd/schema.usda@,
        @usdGeom/schema.usda@
    ]
)

over "GLOBAL" (
    customData = {
        string libraryName   = "omniExampleSchema"
        string libraryPath   = "./"
        string libraryPrefix = "OmniExample"
    }
) {
}

class OmniMeshLod "OmniMeshLod" (
    inherits = </Xform>
)
{
    uniform token lodTransitionScheme = "blend" (
        allowedTokens = ["blend", "pop"]
        doc = """LOD transition"""
    )

    float[] lodLevels (
        doc = """ LOD levels"""
    )

    rel lodMeshes (
        doc = """lod meshes""
    )

}

Compiling error messages


INFO:usd-plugin-samples:Pulling dependencies for nv-usd 22.11 Python 3.10...
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- No generate directory provided, defaulting to D:/WORKS/Ominverse/DEV/usd-plugin-samples/_build/cmake/src/usd-plugins/schema/omniExampleCodelessSchema/generated
-- Plugin root not assigned, defaulting to: D:/WORKS/Ominverse/DEV/usd-plugin-samples/src/usd-plugins/schema/omniExampleCodelessSchema
-- No generate directory provided, defaulting to D:/WORKS/Ominverse/DEV/usd-plugin-samples/_build/cmake/src/usd-plugins/schema/omniExampleSchema/generated
-- Plugin root not assigned, defaulting to: D:/WORKS/Ominverse/DEV/usd-plugin-samples/src/usd-plugins/schema/omniExampleSchema
-- No generate directory provided, defaulting to D:/WORKS/Ominverse/DEV/usd-plugin-samples/_build/cmake/src/usd-plugins/schema/omniMetSchema/generated
-- Plugin root not assigned, defaulting to: D:/WORKS/Ominverse/DEV/usd-plugin-samples/src/usd-plugins/schema/omniMetSchema
-- Configuring done (0.7s)
-- Generating done (0.3s)
-- Build files have been written to: D:/WORKS/Ominverse/DEV/usd-plugin-samples/_build/cmake
MSBuild version 17.11.9+a69bbaaf5 for .NET Framework

     Creating library D:/WORKS/Ominverse/DEV/usd-plugin-samples/_build/cmake/src/usd-plugins/schema/omniExampleSchema/Release/omniExampleSchema.lib and object D:/WORKS/Ominverse/DEV/usd-plugin-samples/_build/cmake/src/u
  sd-plugins/schema/omniExampleSchema/Release/omniExampleSchema.exp
omniMeshLod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomImageable::~UsdGeomImageable(void)" (__imp_??1UsdGeomImageable@pxrInter
nal_v0_22__pxrReserved__@@UEAA@XZ) referenced in function "public: virtual void * __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomImageable::`scalar deleting destructor'(unsigned int)" (??_GUsdGeomImageable@pxrInternal 
_v0_22__pxrReserved__@@UEAAPEAXI@Z) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]
omniMeshLod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXformable::~UsdGeomXformable(void)" (__imp_??1UsdGeomXformable@pxrInter 
nal_v0_22__pxrReserved__@@UEAA@XZ) referenced in function "public: virtual void * __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXformable::`scalar deleting destructor'(unsigned int)" (??_GUsdGeomXformable@pxrInternal 
_v0_22__pxrReserved__@@UEAAPEAXI@Z) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]
omniMeshLod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXform::~UsdGeomXform(void)" (__imp_??1UsdGeomXform@pxrInternal_v0_22__p 
xrReserved__@@UEAA@XZ) referenced in function "public: virtual __cdecl pxrInternal_v0_22__pxrReserved__::OmniExampleOmniMeshLod::~OmniExampleOmniMeshLod(void)" (??1OmniExampleOmniMeshLod@pxrInternal_v0_22__pxrReserved__ 
@@UEAA@XZ) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]
omniMeshLod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class std::vector<class pxrInternal_v0_22__pxrReserved__::TfToken,class std::allocator<class pxrInternal_v0_22__pxrReserv 
ed__::TfToken> > const & __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXform::GetSchemaAttributeNames(bool)" (__imp_?GetSchemaAttributeNames@UsdGeomXform@pxrInternal_v0_22__pxrReserved__@@SAAEBV?$vector@VTfToken@pxrI 
nternal_v0_22__pxrReserved__@@V?$allocator@VTfToken@pxrInternal_v0_22__pxrReserved__@@@std@@@std@@_N@Z) referenced in function "public: static class std::vector<class pxrInternal_v0_22__pxrReserved__::TfToken,class std: 
:allocator<class pxrInternal_v0_22__pxrReserved__::TfToken> > const & __cdecl pxrInternal_v0_22__pxrReserved__::OmniExampleOmniMeshLod::GetSchemaAttributeNames(bool)" (?GetSchemaAttributeNames@OmniExampleOmniMeshLod@pxr 
Internal_v0_22__pxrReserved__@@SAAEBV?$vector@VTfToken@pxrInternal_v0_22__pxrReserved__@@V?$allocator@VTfToken@pxrInternal_v0_22__pxrReserved__@@@std@@@std@@_N@Z) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\ 
src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]
    Hint on symbols that are defined and could potentially match:
      "__declspec(dllimport) public: static class std::vector<class pxrInternal_v0_22__pxrReserved__::TfToken,class std::allocator<class pxrInternal_v0_22__pxrReserved__::TfToken> > const & __cdecl pxrInternal_v0_22__px 
  rReserved__::UsdAPISchemaBase::GetSchemaAttributeNames(bool)" (__imp_?GetSchemaAttributeNames@UsdAPISchemaBase@pxrInternal_v0_22__pxrReserved__@@SAAEBV?$vector@VTfToken@pxrInternal_v0_22__pxrReserved__@@V?$allocator@V 
  TfToken@pxrInternal_v0_22__pxrReserved__@@@std@@@std@@_N@Z)
omniMeshLod.obj : error LNK2001: unresolved external symbol "protected: virtual enum pxrInternal_v0_22__pxrReserved__::UsdSchemaKind __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomImageable::_GetSchemaKind(void)const  
" (?_GetSchemaKind@UsdGeomImageable@pxrInternal_v0_22__pxrReserved__@@MEBA?AW4UsdSchemaKind@2@XZ) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxpro 
j]
omniMeshLod.obj : error LNK2001: unresolved external symbol "protected: virtual enum pxrInternal_v0_22__pxrReserved__::UsdSchemaKind __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXform::_GetSchemaKind(void)const " (? 
_GetSchemaKind@UsdGeomXform@pxrInternal_v0_22__pxrReserved__@@MEBA?AW4UsdSchemaKind@2@XZ) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]       
omniMeshLod.obj : error LNK2001: unresolved external symbol "protected: virtual enum pxrInternal_v0_22__pxrReserved__::UsdSchemaKind __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXformable::_GetSchemaKind(void)const  
" (?_GetSchemaKind@UsdGeomXformable@pxrInternal_v0_22__pxrReserved__@@MEBA?AW4UsdSchemaKind@2@XZ) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxpro 
j]
omniMeshLod.obj : error LNK2001: unresolved external symbol "private: virtual class pxrInternal_v0_22__pxrReserved__::TfType const & __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomImageable::_GetTfType(void)const " (? 
_GetTfType@UsdGeomImageable@pxrInternal_v0_22__pxrReserved__@@EEBAAEBVTfType@2@XZ) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]
omniMeshLod.obj : error LNK2001: unresolved external symbol "private: virtual class pxrInternal_v0_22__pxrReserved__::TfType const & __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXform::_GetTfType(void)const " (?_Get 
TfType@UsdGeomXform@pxrInternal_v0_22__pxrReserved__@@EEBAAEBVTfType@2@XZ) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]
omniMeshLod.obj : error LNK2001: unresolved external symbol "private: virtual class pxrInternal_v0_22__pxrReserved__::TfType const & __cdecl pxrInternal_v0_22__pxrReserved__::UsdGeomXformable::_GetTfType(void)const " (?
_GetTfType@UsdGeomXformable@pxrInternal_v0_22__pxrReserved__@@EEBAAEBVTfType@2@XZ) [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]
D:\WORKS\Ominverse\DEV\usd-plugin-samples\_build\cmake\src\usd-plugins\schema\omniExampleSchema\Release\omniExampleSchema.dll : fatal error LNK1120: 10 unresolved externals [D:\WORKS\Ominverse\DEV\usd-plugin-samples\_bu 
ild\cmake\src\usd-plugins\schema\omniExampleSchema\omniExampleSchema.vcxproj]```
ThaiLe-gt commented 2 weeks ago

I found the problem is that I haven't declared the usdGeom library in NvPxrPlugin.cmake file. To fix this, I added the following line: target_link_libraries(${PXR_PLUGIN_PYTHON_TARGET_NAME} PUBLIC usdGeom) in line 731 and line 875. Once usdGeom is declared, I can build my custom schema

asluk commented 2 weeks ago

Thanks @ThaiLe-gt -- that is the expected behavior and fix. Can this be closed? 🙏🏼

ThaiLe-gt commented 2 weeks ago

Sure, I will close it. Thanks @asluk