Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved External Symbols when trying to use custom schema & general custom schema guidance #3140

Open
msf567 opened this issue Jun 24, 2024 · 3 comments
Labels
build Build-related issue/PR help wanted Indicates an issue where help and/or a pull request from the community would be very welcome

Comments

@msf567
Copy link

msf567 commented Jun 24, 2024

I am trying to consume my new schema in Visual Studio, but I must be doing something wrong because I am getting unresolved external symbol errors.

Here is my schema file for reference:

#usda 1.0
(
    """InteractableMesh Schema"""
    subLayers = [
        @usdGeom\schema.usda@
    ]
)

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

class "InteractiveMesh" (
    doc = """A mesh that can be interacted with."""
    inherits = </Gprim>
    customData = {
        string className = "IMesh"
    }
)
{
    float state = 1.0 (
        doc = "The state of the interactable mesh"
    )
}

class ComplexPrim "ComplexPrim" (
    doc = """An example of a untyped IsA schema prim"""
    # Inherits from </SimplePrim> defined in simple.usda.
    inherits = </InteractiveMesh>
    customData = {
        string className = "Complex"
    }
)  
{
    string complexString = "somethingComplex"
}

The line that is failing is:
auto myComplex = pxr::SCComplex::Define(stagePtr, pxr::SdfPath("/MyComplexObject"));

The two errors:
unresolved external symbol "_declspec(dllimport) public: virtual cdecl pxrInternal_v0_24__pxrReserved::SCComplex::~SCComplex(void)" (imp??1SCComplex@pxrInternal_v0_24__pxrReserved@@UEAA@XZ) referenced in function WinMain

unresolved external symbol "declspec(dllimport) public: static class pxrInternal_v0_24__pxrReserved::SCComplex cdecl pxrInternal_v0_24__pxrReserved::SCComplex::Define(class pxrInternal_v0_24__pxrReserved__::TfWeakPtr const &,class pxrInternal_v0_24__pxrReserved__::SdfPath const &)" (imp?Define@SCComplex@pxrInternal_v0_24__pxrReserved_@@sa?AV12@AEBV?$TfWeakPtr@VUsdStage@pxrInternal_v0_24__pxrReserved__@@@2@AEBVSdfPath@2@@z) referenced in function WinMain

Some things to note:

  • I am definitely linking to the built .lib file in my visual studio project
  • My header files seem to be configured correctly (my compiler recognizes the SCComplex type just fine, and exposes the Define method)
  • Do I need to bring in the actual cpp files to my visual studio project? like "complex.cpp" etc? When I do that, I get a host of other errors, and it doesn't seem like that should be necessary because I am linking to the generated .lib file.

What am I missing? I have been trying to generate a simple schema for days, I would really appreciate some guidance here and maybe other people int he future will find this helpful.

Thanks!

@msf567
Copy link
Author

msf567 commented Jun 24, 2024

Another interesting thing to note:

When I look in the generated .lib file with DUMPBIN, I don't see a lot of exported functions I would otherwise expect to.

`Dump of file A:\Brightline\Schemas\build\InteractiveMeshSchema\Release\InteractiveMeshSchema.lib

File Type: LIBRARY

 Exports

   ordinal    name

              ??0SCTokensType@pxrInternal_v0_24__pxrReserved__@@QEAA@XZ (public: __cdecl pxrInternal_v0_24__pxrReserved__::SCTokensType::SCTokensType(void))
              ?SCTokens@pxrInternal_v0_24__pxrReserved__@@3V?$TfStaticData@USCTokensType@pxrInternal_v0_24__pxrReserved__@@U?$Tf_StaticDataDefaultFactory@USCTokensType@pxrInternal_v0_24__pxrReserved__@@@2@@1@A (class pxrInternal_v0_24__pxrReserved__::TfStaticData<struct pxrInternal_v0_24__pxrReserved__::SCTokensType,struct pxrInternal_v0_24__pxrReserved__::Tf_StaticDataDefaultFactory<struct pxrInternal_v0_24__pxrReserved__::SCTokensType> > pxrInternal_v0_24__pxrReserved__::SCTokens)`

Is this an issue with how I am building my plugin?

for reference, my CMakeLists.txt looks like this:

set(PXR_PACKAGE InteractiveMeshSchema)

add_library(${PXR_PACKAGE} SHARED
    tokens.cpp
    wrapTokens.cpp
)

target_include_directories(${PXR_PACKAGE}
    PRIVATE
        ${PXR_INCLUDE_DIRS}
)

target_link_libraries(${PXR_PACKAGE}
    PRIVATE
        ${PXR_LIBRARIES}
)

and my build command is
cmake --build . --config Release
and
cmake .. -DPXR_BUILD_DOCUMENTATION=OFF -DPXR_BUILD_TESTS=OFF

@msf567 msf567 changed the title Unresolved External Symbols when trying to use custom schema Unresolved External Symbols when trying to use custom schema & general custom schema guidance Jun 24, 2024
@jesschimein
Copy link
Contributor

Filed as internal issue #USD-9802

@dgovil dgovil added help wanted Indicates an issue where help and/or a pull request from the community would be very welcome build Build-related issue/PR labels Oct 31, 2024
@dgovil
Copy link
Collaborator

dgovil commented Oct 31, 2024

Sorry for the delay in response, are you still experiencing this issue with USD 24.11? (I would imagine so, but just want to check since we didn't get you a response sooner that maybe you'd solved it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build-related issue/PR help wanted Indicates an issue where help and/or a pull request from the community would be very welcome
Projects
None yet
Development

No branches or pull requests

3 participants