Replies: 3 comments
-
I have to say that I want to build Bullet3 with GCC but I can't, I can only build it with Visual Studio. But the big advantage of using both compilers is there are general errors that impossible to solve with Visual Studio while it's easier to solve with GCC that's why I prefer GCC in some cases, people say that Clang is faster and better than GCC but GCC is already better than Visual Studio on some error detections. The .cpp code that uses Bullet:
|
Beta Was this translation helpful? Give feedback.
-
I had the exact same problem but it compiled with gcc after I installed bullet with vcpkg with the following command
My rough CMakeLists.txt cmake_minimum_required(VERSION 3.5)
# Replace with path to vcpkg installation
set(CMAKE_PREFIX_PATH "path-to-vcpkg/vcpkg/installed/x64-mingw-dynamic/share")
project(MyProject CXX)
# Set C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#bullet3
find_package(Bullet CONFIG REQUIRED)
# Include Bullet directories
include_directories(${BULLET_INCLUDE_DIRS})
# Adding source files
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp") # Define PROJECT_SOURCES as a list of all source files
set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/src/") # Define PROJECT_INCLUDE to be the path to the include directory of the project
# Declaring executable
add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE})
#bullet3
target_link_libraries(${PROJECT_NAME} PRIVATE ${BULLET_LIBRARIES}) |
Beta Was this translation helpful? Give feedback.
-
@mandaxyz and @DaveH355 I've had success building with cmake, I made a little tutorial on it here: https://cuppajoeman.github.io/bullet-physics-manual/Building.html, let me know if that works for either of you. |
Beta Was this translation helpful? Give feedback.
-
In the CMakeLists.txt of the executable:
In the CMakeLists.txt of the third-party folder where Bullet folder is placed:
How to fix this please, I got many errors with GCC 12.2.0 (but everything is ok with Visual Studio 2017 compiler which means no error):
[build] C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../third-party/bullet-3.25/src/BulletDynamics/libBulletDynamics.a(btTypedConstraint.cpp.obj): in function
btRigidBody::~btRigidBody()': [build] D:/my_project/third-party/bullet-3.25/src/BulletDynamics/Dynamics/btRigidBody.h:178: undefined reference to
btCollisionObject::~btCollisionObject()'[build] C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../third-party/bullet-3.25/src/BulletDynamics/libBulletDynamics.a(btRigidBody.cpp.obj): in function
btRigidBody::btRigidBody(btRigidBody::btRigidBodyConstructionInfo const&)': [build] D:/my_project/third-party/bullet-3.25/src/BulletDynamics/Dynamics/btRigidBody.cpp:29: undefined reference to
btCollisionObject::btCollisionObject()'[build] C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/my_project/third-party/bullet-3.25/src/BulletDynamics/Dynamics/btRigidBody.cpp:32: undefined reference to
btCollisionObject::~btCollisionObject()' [build] C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../third-party/bullet-3.25/src/BulletDynamics/libBulletDynamics.a(btRigidBody.cpp.obj): in function
btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)':Beta Was this translation helpful? Give feedback.
All reactions