Hello,
I built the latest openUSD library using the instructions given on the openusd website.
After that, I tried to make two simple examples to check if everything was working fine, one in python and another in in C++.
The python one is working perfectly fine, but as soon as I try the same code in C++, it doesn’t built anymore.
Here are the errors I am getting:
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(140): warning C4003: not enough arguments for function-like macro invocation 'max'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(232): warning C4003: not enough arguments for function-like macro invocation 'max'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(403): warning C4003: not enough arguments for function-like macro invocation 'max'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(403): error C2589: '(': illegal token on right side of '::'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(403): error C2062: type 'unknown-type' unexpected
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(403): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(406): error C2143: syntax error: missing ')' before ';'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(406): error C2059: syntax error: ')'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(406): error C2238: unexpected token(s) preceding ';'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(409): error C2059: syntax error: '}'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_growth_policy.h(409): error C2143: syntax error: missing ';' before '}'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C2039: 'rh': is not a member of 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(49): note: see declaration of 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C3083: 'rh': the symbol to the left of a '::' must be a type
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C2039: 'power_of_two_growth_policy': is not a member of 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(49): note: see declaration of 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C2065: 'power_of_two_growth_policy': undeclared identifier
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C2974: 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl::detail_robin_hash::is_power_of_two_policy': invalid template argument for 'U', type expected
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(67): note: see declaration of 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl::detail_robin_hash::is_power_of_two_policy'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C2988: unrecognizable template declaration/definition
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C2143: syntax error: missing ';' before '>'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C3855: 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl::detail_robin_hash::is_power_of_two_policy': template parameter 'U' is incompatible with the declaration
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(70): error C2059: syntax error: '>'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(71): error C2059: syntax error: 'function-style cast'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(71): error C2143: syntax error: missing ';' before '{'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(71): error C2447: '{': missing function header (old-style formal list?)
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(114): warning C4003: not enough arguments for function-like macro invocation 'max'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(114): error C2589: '(': illegal token on right side of '::'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(114): error C2062: type 'unknown-type' unexpected
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(114): error C2059: syntax error: ')'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(115): warning C4003: not enough arguments for function-like macro invocation 'max'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(115): error C2589: '(': illegal token on right side of '::'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(115): error C2059: syntax error: ')'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(116): error C2059: syntax error: ')'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(320): warning C4003: not enough arguments for function-like macro invocation 'max'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(320): error C2589: '(': illegal token on right side of '::'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(320): note: the template instantiation context (the oldest one first) is
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(331): note: see reference to class template instantiation 'pxrInternal_v0_24__pxrReserved__::pxrInternal_v0_24__pxrReserved__::pxr_tsl::detail_robin_hash::bucket_entry<ValueType,StoreHash>' being compiled
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(320): error C2059: syntax error: ')'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(320): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(331): error C2143: syntax error: missing ')' before ';'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(331): error C2059: syntax error: ')'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(331): error C2238: unexpected token(s) preceding ';'
C:\USD_Binairies\include\pxr\base\tf\pxrTslRobinMap\robin_hash.h(331): fatal error C1201: unable to continue after syntax error in class template definition
I am making the project using cmake, here is how my cmakelist looks like:
cmake_minimum_required(VERSION 3.28)
project(Pipeline)
set(CMAKE_CXX_STANDARD 17)
set(MY_USD_BUILD_DIR "C:/USD_Binairies")
include_directories(${MY_USD_BUILD_DIR}/include)
link_directories(${MY_USD_BUILD_DIR}/lib)
set(Boost_INCLUDE_DIR ${MY_USD_BUILD_DIR}/include/boost-1_82)
find_package(Python3 REQUIRED COMPONENTS Development)
find_package(Boost REQUIRED COMPONENTS python)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${Python3_INCLUDE_DIRS})
add_executable(Pipeline main.cpp)
target_link_libraries(Pipeline usd_usdGeom usd_usd usd_sdf usd_vt usd_tf ${Boost_LIBRAIRIES} ${Python3_LIBRAIRIES})
Also, here is my basic C++ code, which doesn’t build, in case it’s happening from there:
#include <iostream>
#include <pxr/usd/usdGeom/xform.h>
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usdGeom/sphere.h>
int main() {
std::cout << "Hello, World!" << std::endl;
auto stage = pxr::UsdStage::CreateNew(std::string("HelloWorldCpp.usda"));
auto xFormPrim = pxr::UsdGeomXform::Define(stage, pxr::SdfPath(std::string("/hello")));
auto sphere = pxr::UsdGeomSphere::Define(stage, pxr::SdfPath(std::string("/hello/world")));
return 0;
}
For the configuration used:
openusd v24.08
tried on both win10/win11
compiled with vc143 toolchain (VisualStudio 2022)
Any idea on what might happening?
Thanks a lot for the help