RobLoach / raylib-cpp

C++ Object Oriented Wrapper for raylib
https://robloach.github.io/raylib-cpp/
zlib License
669 stars 87 forks source link

Problem Compiling #207

Closed hourin0 closed 2 years ago

hourin0 commented 2 years ago

I couldn't compile files with raylib-cpp.hpp. It gives these errors:

In file included from /usr/local/include/raylib-cpp.hpp:41, from core_basic_window.cpp:22: /usr/local/include/Functions.hpp: In function 'std::vector<std::__cxx11::basic_string<char> > raylib::GetDirectoryFiles(const string&)': /usr/local/include/Functions.hpp:150:22: error: '::GetDirectoryFiles' has not been declared; did you mean 'raylib::GetDirectoryFiles'? 150 | char** files = ::GetDirectoryFiles(dirPath.c_str(), &count); | ^~~~~~~~~~~~~~~~~ | raylib::GetDirectoryFiles /usr/local/include/Functions.hpp:148:35: note: 'raylib::GetDirectoryFiles' declared here 148 | RLCPPAPI std::vector<std::string> GetDirectoryFiles(const std::string& dirPath) { | ^~~~~~~~~~~~~~~~~ /usr/local/include/Functions.hpp:152:7: error: '::ClearDirectoryFiles' has not been declared; did you mean 'LoadDirectoryFiles'? 152 | ::ClearDirectoryFiles(); | ^~~~~~~~~~~~~~~~~~~ | LoadDirectoryFiles /usr/local/include/Functions.hpp: In function 'std::vector<std::__cxx11::basic_string<char> > raylib::GetDroppedFiles()': /usr/local/include/Functions.hpp:172:22: error: '::GetDroppedFiles' has not been declared; did you mean 'raylib::GetDroppedFiles'? 172 | char** files = ::GetDroppedFiles(&count); | ^~~~~~~~~~~~~~~ | raylib::GetDroppedFiles /usr/local/include/Functions.hpp:167:35: note: 'raylib::GetDroppedFiles' declared here 167 | RLCPPAPI std::vector<std::string> GetDroppedFiles() { | ^~~~~~~~~~~~~~~ /usr/local/include/Functions.hpp:174:7: error: '::ClearDroppedFiles' has not been declared; did you mean 'LoadDroppedFiles'? 174 | ::ClearDroppedFiles(); | ^~~~~~~~~~~~~~~~~ | LoadDroppedFiles In file included from /usr/local/include/raylib-cpp.hpp:45, from core_basic_window.cpp:22: /usr/local/include/Matrix.hpp: In member function 'raylib::Matrix raylib::Matrix::Normalize() const': /usr/local/include/Matrix.hpp:94:18: error: '::MatrixNormalize' has not been declared 94 | return ::MatrixNormalize(*this); | ^~~~~~~~~~~~~~~ In file included from /usr/local/include/Mesh.hpp:10, from /usr/local/include/raylib-cpp.hpp:46, from core_basic_window.cpp:22: /usr/local/include/Model.hpp: In member function 'RayCollision raylib::Model::GetCollision(const Ray&) const': /usr/local/include/Model.hpp:113:18: error: '::GetRayCollisionModel' has not been declared; did you mean 'GetRayCollisionMesh'? 113 | return ::GetRayCollisionModel(ray, *this); | ^~~~~~~~~~~~~~~~~~~~ | GetRayCollisionMesh In file included from /usr/local/include/raylib-cpp.hpp:46, from core_basic_window.cpp:22: /usr/local/include/Mesh.hpp: In member function 'raylib::Mesh& raylib::Mesh::Binormals()': /usr/local/include/Mesh.hpp:261:11: error: '::GenMeshBinormals' has not been declared; did you mean 'GenMeshTorus'? 261 | ::GenMeshBinormals(this); | ^~~~~~~~~~~~~~~~ | GenMeshTorus In file included from /usr/local/include/Ray.hpp:6, from /usr/local/include/raylib-cpp.hpp:51, from core_basic_window.cpp:22: /usr/local/include/RayCollision.hpp: In constructor 'raylib::RayCollision::RayCollision(const Ray&, const Model&)': /usr/local/include/RayCollision.hpp:30:15: error: '::GetRayCollisionModel' has not been declared; did you mean 'GetRayCollisionMesh'? 30 | set(::GetRayCollisionModel(ray, model)); | ^~~~~~~~~~~~~~~~~~~~ | GetRayCollisionMesh In file included from /usr/local/include/raylib-cpp.hpp:51, from core_basic_window.cpp:22: /usr/local/include/Ray.hpp: In member function 'raylib::RayCollision raylib::Ray::GetCollision(const Model&) const': /usr/local/include/Ray.hpp:72:16: error: 'GetRayCollisionModel' was not declared in this scope; did you mean 'GetRayCollisionMesh'? 72 | return GetRayCollisionModel(*this, model); | ^~~~~~~~~~~~~~~~~~~~ | GetRayCollisionMesh

I'm sure raylib is working because other C programs compiled fine when I only include raylib.h I'm using the latest version of raylib-cpp, using raylib 4.0.0, and compiled with g++ core_basic_window.cpp -lraylib. What did I do wrong here?

hourin0 commented 2 years ago

bruh

i screwed up some stuff. turned out i still have the raylib.h and raymath.h files from 4.2.0 instead of 4.0.0, while the libraylib.so is 4.0.0 :moyai: raylib-cpp works fine after i read the contents of those 2 files in /usr/local/include/ and replaced them with the 4.0.0 version. very embarrassed. hope no one notice this.

RobLoach commented 2 years ago

Hoping to update to raylib 4.2 soon. In the mean time, there's the next branch :wink: https://github.com/RobLoach/raylib-cpp/pull/188