The newest version of OpenCV(4) does not come with createsamples feature for creating HAAR CASCADE files. It's just mind boggling. To attain this feature, there are two solutions: 1) Download an older version on a different machine or 2) Compile createsamples.cpp I am choosing item two as anyone can settle for kluge anytime. Item two comes with many errors that look the same as shown below:
harry#harry-usedmachine:/usr/include/opencv4$ sudo g++ createsamples.cpp
[sudo] password for harry:
In file included from createsamples.cpp:48:
/usr/include/opencv4/opencv2/core.hpp:2523:16: error: ‘FileStorage’ has not been declared
2523 | void write(FileStorage& fs) const;
| ^~~~~~~~~~~
/usr/include/opencv4/opencv2/core.hpp:2573:15: error: ‘FileStorage’ has not been declared
2573 | void save(FileStorage& fs) const;
| ^~~~~~~~~~~
/usr/include/opencv4/opencv2/core.hpp:2577:21: error: ‘FileStorage’ does not name a type
2577 | void load(const FileStorage& node);
| ^~~~~~~~~~~
/usr/include/opencv4/opencv2/core.hpp:3088:24: error: ‘FileStorage’ has not been declared
3088 | virtual void write(FileStorage& fs) const { CV_UNUSED(fs); }
| ^~~~~~~~~~~
/usr/include/opencv4/opencv2/core.hpp:3093:34: error: ‘FileStorage’ was not declared in this scope
3093 | CV_WRAP void write(const Ptr<FileStorage>& fs, const String& name = String()) const;
| ^~~~~~~~~~~
/usr/include/opencv4/opencv2/core.hpp:3093:45: error: template argument 1 is invalid
3093 | CV_WRAP void write(const Ptr<FileStorage>& fs, const String& name = String()) const;
| ^
/usr/include/opencv4/opencv2/core.hpp:3172:22: error: ‘FileStorage’ has not been declared
3172 | void writeFormat(FileStorage& fs) const;
| ^~~~~~~~~~~
/usr/include/opencv4/opencv2/core.hpp: In static member function ‘static cv::Ptr<_Tp> cv::Algorithm::load(const String&, const String&)’:
/usr/include/opencv4/opencv2/core.hpp:3135:9: error: ‘FileStorage’ was not declared in this scope
3135 | FileStorage fs(filename, FileStorage::READ);
| ^~~~~~~~~~~
In file included from /usr/include/opencv4/opencv2/core.hpp:55,
from createsamples.cpp:48:
/usr/include/opencv4/opencv2/core.hpp:3136:19: error: ‘fs’ was not declared in this scope; did you mean ‘ffs’?
3136 | CV_Assert(fs.isOpened());
| ^~
/usr/include/opencv4/opencv2/core/base.hpp:342:38: note: in definition of macro ‘CV_Assert’
342 | #define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
| ^~~~
In file included from createsamples.cpp:48:
/usr/include/opencv4/opencv2/core.hpp:3137:41: error: ‘fs’ was not declared in this scope; did you mean ‘ffs’?
3137 | FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
| ^~
| ffs
/usr/include/opencv4/opencv2/core.hpp:3137:18: error: ‘fn’ has incomplete type
3137 | FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
| ^~
In file included from /usr/include/opencv4/opencv2/core/base.hpp:58,
from /usr/include/opencv4/opencv2/core.hpp:55,
from createsamples.cpp:48:
/usr/include/opencv4/opencv2/core/cvstd.hpp:150:18: note: forward declaration of ‘class cv::FileNode’
150 | class CV_EXPORTS FileNode; //for string constructor from FileNode
| ^~~~~~~~
In file included from createsamples.cpp:48:
/usr/include/opencv4/opencv2/core.hpp: In static member function ‘static cv::Ptr<_Tp> cv::Algorithm::loadFromString(const String&, const String&)’:
/usr/include/opencv4/opencv2/core.hpp:3156:9: error: ‘FileStorage’ was not declared in this scope
3156 | FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY);
| ^~~~~~~~~~~
/usr/include/opencv4/opencv2/core.hpp:3157:41: error: ‘fs’ was not declared in this scope; did you mean ‘ffs’?
3157 | FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
| ^~
| ffs
Many of the errors are coming from core.hpp and createsample.cpp. createsample.cpp is here: https://github.com/opencv/opencv/blob/master/apps/createsamples/createsamples.cpp
and core.hpp is here: https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core.hpp
Would much appreciate any insights on fixing these errors.
Easiest way seems to be downloading an older opencv version source code like https://github.com/opencv/opencv/archive/2.4.13.6.zip and extract it to any location. In that folder perform
mkdir build
cd build
cmake ..
make
cd bin
there you will find the binaries of opencv_createsamples, opencv_traincascade etc.
It is NOT necessary to install that old version (that would happen if you use 'make install' ), just use your currently installed opencv build of any version for all tasks and if you need to create sample or train a cascade, use this build at the directory where you copy it to.
Related
I made a project with SDL2 under Windows.
When I try to compile it on Linux, these errors occur:
reilbas#reilbas:~/C/a/Labyrinthe-3D-main$ g++ -o test -I include src/*.cpp $(sdl2-config --cflags --libs)
src/Affichage.cpp: In member function ‘void Affichage::drawRect(float, float, float, float, SDL_Color&)’:
src/Affichage.cpp:110:17: error: ‘SDL_Vertex’ was not declared in this scope; did you mean ‘SDL_mutex’?
110 | std::vector<SDL_Vertex> triUi1 = {
| ^~~~~~~~~~
| SDL_mutex
src/Affichage.cpp:110:27: error: template argument 1 is invalid
110 | std::vector<SDL_Vertex> triUi1 = {
| ^
src/Affichage.cpp:110:27: error: template argument 2 is invalid
src/Affichage.cpp:110:29: error: scalar object ‘triUi1’ requires one element in initializer
110 | std::vector<SDL_Vertex> triUi1 = {
| ^~~~~~
src/Affichage.cpp:115:27: error: template argument 2 is invalid
115 | std::vector<SDL_Vertex> triUi2 = {
| ^
src/Affichage.cpp:115:29: error: scalar object ‘triUi2’ requires one element in initializer
115 | std::vector<SDL_Vertex> triUi2 = {
| ^~~~~~
src/Affichage.cpp:120:5: error: ‘SDL_RenderGeometry’ was not declared in this scope; did you mean ‘SDL_RenderCopy’?
120 | SDL_RenderGeometry(renderer, nullptr, triUi1.data(), triUi1.size(), nullptr, 0);
| ^~~~~~~~~~~~~~~~~~
| SDL_RenderCopy
src/Affichage.cpp: In member function ‘void Affichage::displayTri(std::vector<triangle>)’:
src/Affichage.cpp:146:21: error: ‘SDL_Vertex’ was not declared in this scope; did you mean ‘SDL_mutex’?
146 | std::vector<SDL_Vertex> verts = {
| ^~~~~~~~~~
| SDL_mutex
src/Affichage.cpp:146:31: error: template argument 1 is invalid
146 | std::vector<SDL_Vertex> verts = {
| ^
src/Affichage.cpp:146:31: error: template argument 2 is invalid
src/Affichage.cpp:146:33: error: scalar object ‘verts’ requires one element in initializer
146 | std::vector<SDL_Vertex> verts = {
| ^~~~~
src/Affichage.cpp:151:9: error: ‘SDL_RenderGeometry’ was not declared in this scope; did you mean ‘SDL_RenderCopy’?
151 | SDL_RenderGeometry( renderer, nullptr, verts.data(), verts.size(), nullptr, 0);
| ^~~~~~~~~~~~~~~~~~
| SDL_RenderCopy
src/AllMath.cpp: In static member function ‘static int AllMath::triangleClipAgainstPlane(vec3d, vec3d, triangle&, triangle&, triangle&)’:
src/AllMath.cpp:254:1: warning: control reaches end of non-void function [-Wreturn-type]
254 | }
| ^
I installed SDL2 with apt:
$ sudo apt-get install libsdl2
SDL_RenderGeometry() & friends were introduced in SDL 2.0.18:
Added SDL_RenderGeometry() and SDL_RenderGeometryRaw() to allow rendering of arbitrary shapes using the SDL 2D render API
...so make sure you're using that version or higher.
SDL 2.0.18 was released in late 2021 so distros like Ubuntu 20.04 that ship older versions of SDL won't have those newer functions.
I have an object qp that is defined as
#include <proxsuite/proxqp/dense/dense.hpp>
namespace fr3_ros {
class WaypointController : public controller_interface::MultiInterfaceController<franka_hw::FrankaModelInterface,
hardware_interface::EffortJointInterface,
franka_hw::FrankaStateInterface> {
...
private:
proxsuite::proxqp::isize dim = 14;
proxsuite::proxqp::isize n_eq = 7;
proxsuite::proxqp::isize n_in = 0;
proxsuite::proxqp::dense::QP<double> qp(dim, n_eq, n_in);
...
}
From the documetation here controller_interface::MultiInterfaceController has the constructor
MultiInterfaceController (bool allow_optional_interfaces=false)
Since I did not define a new constructor, that would be the only constructor WaypointController has.
However, if I put this in the header file it would give me an error when compiling:
In file included from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:1:
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:113:43: error: ‘dim’ is not a type
113 | proxsuite::proxqp::dense::QP<double> qp(dim, n_eq, n_in);
| ^~~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:113:48: error: ‘n_eq’ is not a type
113 | proxsuite::proxqp::dense::QP<double> qp(dim, n_eq, n_in);
| ^~~~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:113:54: error: ‘n_in’ is not a type
113 | proxsuite::proxqp::dense::QP<double> qp(dim, n_eq, n_in);
| ^~~~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp: In member function ‘virtual void fr3_ros::WaypointController::update(const ros::Time&, const ros::Duration&)’:
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:225:5: error: invalid use of member function ‘proxsuite::proxqp::dense::QP<double> fr3_ros::WaypointController::qp(int, int, int)’ (did you forget the ‘()’ ?)
225 | qp.update(qp_H, qp_g, qp_A, qp_b, std::nullopt, std::nullopt, std::nullopt);
| ^~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:227:5: error: invalid use of member function ‘proxsuite::proxqp::dense::QP<double> fr3_ros::WaypointController::qp(int, int, int)’ (did you forget the ‘()’ ?)
227 | qp.init(qp_H, qp_g, qp_A, qp_b, std::nullopt, std::nullopt, std::nullopt);
| ^~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:230:3: error: invalid use of member function ‘proxsuite::proxqp::dense::QP<double> fr3_ros::WaypointController::qp(int, int, int)’ (did you forget the ‘()’ ?)
230 | qp.solve();
| ^~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:232:13: error: invalid use of member function ‘proxsuite::proxqp::dense::QP<double> fr3_ros::WaypointController::qp(int, int, int)’ (did you forget the ‘()’ ?)
232 | torques = qp.results.x.bottomLeftCorner(7, 1);
| ^~
I also tried separating the declaration and definition, in the header file I have
proxsuite::proxqp::isize dim = 14;
proxsuite::proxqp::isize n_eq = 7;
proxsuite::proxqp::isize n_in = 0;
proxsuite::proxqp::dense::QP<double> qp;
and in the source file I have
qp = proxsuite::proxqp::dense::QP<double>(dim, n_eq, n_in);
this gives me another error
In file included from /opt/ros/noetic/include/class_loader/class_loader_core.hpp:45,
from /opt/ros/noetic/include/class_loader/class_loader.hpp:46,
from /opt/ros/noetic/include/pluginlib/class_list_macros.hpp:40,
from /opt/ros/noetic/include/pluginlib/class_list_macros.h:35,
from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:13:
/opt/ros/noetic/include/class_loader/meta_object.hpp: In instantiation of ‘B* class_loader::impl::MetaObject<C, B>::create() const [with C = fr3_ros::WaypointController; B = controller_interface::ControllerBase]’:
/opt/ros/noetic/include/class_loader/meta_object.hpp:196:7: required from here
/opt/ros/noetic/include/class_loader/meta_object.hpp:198:12: error: use of deleted function ‘fr3_ros::WaypointController::WaypointController()’
198 | return new C;
| ^~~~~
In file included from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:1:
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:36:7: note: ‘fr3_ros::WaypointController::WaypointController()’ is implicitly deleted because the default definition would be ill-formed:
36 | class WaypointController : public controller_interface::MultiInterfaceController<franka_hw::FrankaModelInterface,
| ^~~~~~~~~~~~~~~~~~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:36:7: error: no matching function for call to ‘proxsuite::proxqp::dense::QP<double>::QP()’
In file included from /home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/dense.hpp:8,
from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:31,
from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:1:
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:94:3: note: candidate: ‘proxsuite::proxqp::dense::QP<T>::QP(proxsuite::linalg::veg::isize, proxsuite::linalg::veg::isize, proxsuite::linalg::veg::isize) [with T = double; proxsuite::linalg::veg::isize = long int]’
94 | QP(isize _dim, isize _n_eq, isize _n_in)
| ^~
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:94:3: note: candidate expects 3 arguments, 0 provided
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate: ‘proxsuite::proxqp::dense::QP<double>::QP(const proxsuite::proxqp::dense::QP<double>&)’
81 | struct QP
| ^~
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate expects 1 argument, 0 provided
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate: ‘proxsuite::proxqp::dense::QP<double>::QP(proxsuite::proxqp::dense::QP<double>&&)’
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate expects 1 argument, 0 provided
If I add extern in the header file, I get the error
In file included from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:1:
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:113:3: error: storage class specified for ‘qp’
113 | extern proxsuite::proxqp::dense::QP<double> qp;
| ^~~~~~
In file included from /opt/ros/noetic/include/class_loader/class_loader_core.hpp:45,
from /opt/ros/noetic/include/class_loader/class_loader.hpp:46,
from /opt/ros/noetic/include/pluginlib/class_list_macros.hpp:40,
from /opt/ros/noetic/include/pluginlib/class_list_macros.h:35,
from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:13:
/opt/ros/noetic/include/class_loader/meta_object.hpp: In instantiation of ‘B* class_loader::impl::MetaObject<C, B>::create() const [with C = fr3_ros::WaypointController; B = controller_interface::ControllerBase]’:
/opt/ros/noetic/include/class_loader/meta_object.hpp:196:7: required from here
/opt/ros/noetic/include/class_loader/meta_object.hpp:198:12: error: use of deleted function ‘fr3_ros::WaypointController::WaypointController()’
198 | return new C;
| ^~~~~
In file included from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:1:
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:36:7: note: ‘fr3_ros::WaypointController::WaypointController()’ is implicitly deleted because the default definition would be ill-formed:
36 | class WaypointController : public controller_interface::MultiInterfaceController<franka_hw::FrankaModelInterface,
| ^~~~~~~~~~~~~~~~~~
/home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:36:7: error: no matching function for call to ‘proxsuite::proxqp::dense::QP<double>::QP()’
In file included from /home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/dense.hpp:8,
from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/include/fr3_ros/waypoint_controller.h:31,
from /home/bolun/bolun_ws/src/fr3_ros/fr3_ros/src/waypoint_controller.cpp:1:
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:94:3: note: candidate: ‘proxsuite::proxqp::dense::QP<T>::QP(proxsuite::linalg::veg::isize, proxsuite::linalg::veg::isize, proxsuite::linalg::veg::isize) [with T = double; proxsuite::linalg::veg::isize = long int]’
94 | QP(isize _dim, isize _n_eq, isize _n_in)
| ^~
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:94:3: note: candidate expects 3 arguments, 0 provided
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate: ‘proxsuite::proxqp::dense::QP<double>::QP(const proxsuite::proxqp::dense::QP<double>&)’
81 | struct QP
| ^~
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate expects 1 argument, 0 provided
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate: ‘proxsuite::proxqp::dense::QP<double>::QP(proxsuite::proxqp::dense::QP<double>&&)’
/home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp:81:8: note: candidate expects 1 argument, 0 provided
Is it possible for someone to help me understand what is the issue here? Is the a universal issue in C++ or is it just this package?
Thanks in advance!
If I were to intialize qp using a member initialize list, should it look like:
public:
WaypointController()
: dim(14), neq(7), n_in(0), qp(dim, n_eq, n_in)
{
}
The error message you're getting is not particularly helpful here, but let me explain it anyways, so you understand what's going on.
C++ believes that you're trying to declare a function, not define a variable.
proxsuite::proxqp::dense::QP<double> qp(dim, n_eq, n_in);
The return type is proxsuite::proxqp::dense::QP<double>, the function's name is qp, and it takes 3 parameters, of types dim, n_eq, and n_in.
The fact that this is not what you intended in entirely irrelevant.
Knowing this, your error messages make a lot more sense.
The solution to this is to declare the field in the header file, like so:
proxsuite::proxqp::dense::QP<double> qp;
And then to you need to initialize qp in your constructor. Use a member initialization list for this.
Disclaimer: I haven't done C/C++ in ages and have decided to dive into the deeper end here.
I'm attempting to build esp32-opencv which is basically a version of OpenCV with some necessary changes for the ESP32.
I'm seeing the following error on make that isn't referenced in that project:
esp32-opencv/modules/core/src/softfloat.cpp:3537:107: error: call of overloaded 'softdouble(int)' is ambiguous
3537 | static const float64_t exp_prescale = float64_t::fromRaw(0x3ff71547652b82fe) * float64_t(1 << EXPTAB_SCALE);
| ^
In file included from esp32-opencv/modules/core/src/softfloat.cpp:68:
esp32-opencv/modules/core/include/opencv2/core/softfloat.hpp:257:14: note: candidate: 'cv::softdouble::softdouble(double)'
257 | explicit softdouble( const double a ) { Cv64suf s; s.f = a; v = s.u; }
| ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:248:1: note: candidate: 'cv::softdouble::softdouble(int64_t)'
248 | softdouble::softdouble( const int64_t a ) { *this = i64_to_f64(a); }
| ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:247:1: note: candidate: 'cv::softdouble::softdouble(int32_t)'
247 | softdouble::softdouble( const int32_t a ) { *this = i32_to_f64(a); }
| ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:246:1: note: candidate: 'cv::softdouble::softdouble(uint64_t)'
246 | softdouble::softdouble( const uint64_t a ) { *this = ui64_to_f64(a); }
| ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:245:1: note: candidate: 'cv::softdouble::softdouble(uint32_t)'
245 | softdouble::softdouble( const uint32_t a ) { *this = ui32_to_f64(a); }
| ^~~~~~~~~~
In file included from esp32-opencv/modules/core/src/softfloat.cpp:68:
esp32-opencv/modules/core/include/opencv2/core/softfloat.hpp:232:5: note: candidate: 'cv::softdouble::softdouble(const cv::softdouble&)'
232 | softdouble( const softdouble& c) { v = c.v; }
| ^~~~~~~~~~
Further up in the code it has: #define EXPTAB_SCALE 6 so the complaint seems to be about float64_t(1 << EXPTAB_SCALE) = float64_t(1 << 6) = float64_t(64)?
The definitions all refer to [u]int[size]_t and none for int. I am building this with the xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ compiler. The esp32-opencv project shows that it used xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ (the difference being esp-2022r1-11.2.0 vs esp-2019r2-8.2.0).
I don't have the knowledge to formulate a good guess on why this isn't working with the ESP32 build setup vs compiling it for my 64bit Ubuntu machine. Why would the call not be ambiguous in the latter case, but with the ESP32 build it can't decide which method to use?
If I did have to guess I would think there is some difference in how integer types are being handled in the xtensa-esp32-elf/esp-2019r2-8.2.0 compiler used in the Github project vs the xtensa-esp32-elf/esp-2022r1-11.2.0, but I also have no idea how to check that.
I've built the cross toolchain for Linux under CYGWIN environment using the article at https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/ as a source.
Compilation and installation finished with success.
Used components are:
binutils-2.35
cloog-0.18.1
gcc-10.2.0
glibc-2.32
gmp-6.1.2
isl-0.20
linux-5.9.3
mpc-1.1.0
mpfr-4.0.2
GCC is configured as:
$ x86_64-unknown-linux-gnu-g++ --verbose
Using built-in specs.
COLLECT_GCC=x86_64-unknown-linux-gnu-g++
COLLECT_LTO_WRAPPER=/opt/cross/x86_64-unknown-linux-gnu/libexec/gcc/x86_64-unknown-linux-
gnu/10.2.0/lto-wrapper.exe
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-10.2.0/configure --prefix=/opt/cross/x86_64-unknown-linux-gnu --
target=x86_64-unknown-linux-gnu --enable-languages=c,c++ --disable-nls --disable-multilib --with-
headers=/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/linux
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)
But when I'm trying to compile the simple Hello World application that includes I'm getting a lot of different errors:
$ x86_64-unknown-linux-gnu-g++ main.cpp
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:35,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr.h:148,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/atomicity.h:35,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:39,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:240:34: error: 'clockid_t' has not been declared
240 | clockid_t __clockid,
| ^~~~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:375:12: error: 'cpu_set_t' does not name a type
375 | const cpu_set_t *__cpuset)
| ^~~~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:382:6: error: 'cpu_set_t' has not been declared
382 | cpu_set_t *__cpuset)
| ^~~~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:466:14: error: 'cpu_set_t' does not name a type
466 | const cpu_set_t *__cpuset)
| ^~~~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:471:8: error: 'cpu_set_t' has not been declared
471 | cpu_set_t *__cpuset)
| ^~~~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:765:9: error: 'clockid_t' has not been declared
765 | clockid_t __clockid,
| ^~~~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:911:12: error: 'clockid_t' has not been declared
911 | clockid_t __clockid,
| ^~~~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:933:12: error: 'clockid_t' has not been declared
933 | clockid_t __clockid,
| ^~~~~~~~~
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr.h:148,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/atomicity.h:35,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:39,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:114:1: error: 'sched_yield' was not declared in this scope; did you mean 'pthread_yield'?
114 | __gthrw(sched_yield)
| ^~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:114:1: error: 'sched_yield' was not declared in this scope; did you mean 'pthread_yield'?
114 | __gthrw(sched_yield)
| ^~~~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr-default.h: In function 'int __gthread_yield()':
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:693:33: error: '__gthrw_sched_yield' cannot be used as a function
693 | return __gthrw_(sched_yield) ();
| ^
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/sys/select.h:37,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/sys/types.h:179,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/stdlib.h:394,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/cstdlib:75,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:41,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/basic_string.h:6535,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/string:55,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/locale_classes.h:40,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:41,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/bits/types/struct_timeval.h: At global scope:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/bits/types/struct_timeval.h:8:8: error: redefinition of 'struct timeval'
8 | struct timeval
| ^~~~~~~
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/pthread.h:23,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:35,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/gthr.h:148,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/atomicity.h:35,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:39,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-include/time.h:16:8: note: previous definition of 'struct timeval'
16 | struct timeval {
| ^~~~~~~
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:44,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/basic_string.h:6535,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/string:55,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/locale_classes.h:40,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:41,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h: In constructor '__gnu_cxx::__stoa(_TRet (*)(const _CharT*, _CharT**, _Base ...), const char*, const _CharT*, std::size_t*, _Base ...)::_Save_errno::_Save_errno()':
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:63:27: error: 'errno' was not declared in this scope
63 | _Save_errno() : _M_errno(errno) { errno = 0; }
| ^~~~~
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/basic_string.h:6535,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/string:55,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/locale_classes.h:40,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:41,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:45:1: note: 'errno' is defined in header '<cerrno>'; did you forget to '#include <cerrno>'?
44 | #include <cerrno>
+++ |+#include <cerrno>
45 |
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:44,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/basic_string.h:6535,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/string:55,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/locale_classes.h:40,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:41,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h: In destructor '__gnu_cxx::__stoa(_TRet (*)(const _CharT*, _CharT**, _Base ...), const char*, const _CharT*, std::size_t*, _Base ...)::_Save_errno::~_Save_errno()':
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:64:23: error: 'errno' was not declared in this scope
64 | ~_Save_errno() { if (errno == 0) errno = _M_errno; }
| ^~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:64:23: note: 'errno' is defined in header '<cerrno>'; did you forget to '#include <cerrno>'?
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h: In function '_Ret __gnu_cxx::__stoa(_TRet (*)(const _CharT*, _CharT**, _Base ...), const char*, const _CharT*, std::size_t*, _Base ...)':
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:84:16: error: 'errno' was not declared in this scope
84 | else if (errno == ERANGE
| ^~~~~
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ext/string_conversions.h:84:16: note: 'errno' is defined in header '<cerrno>'; did you forget to '#include <cerrno>'?
In file included from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/system_error:39,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/bits/ios_base.h:46,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ios:42,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/ostream:38,
from /opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/iostream:39,
from main.cpp:1:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/error_constants.h: At global scope:
/opt/cross/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/10.2.0/x86_64-unknown-linux-gnu/bits/error_constants.h:122:27: error: 'ENOTSUP' was not declared in this scope
122 | not_supported = ENOTSUP,
|
UPD: WSL and virtual machines are not an option in my case
I've managed to solve the issue.
The problem was in the sys-include directory
opt/cross/x86_64-unknown-linux-gnu/sys-include
This directory has include files with the same names as the ones from
opt/cross/x86_64-unknown-linux-gnu/include
but with different content.
The sys-include directory was searched by the compiler before the regular include.
Renaming or removing sys-include solves the issue and code can be compiled.
I don't know the purpose of the sys-include directory, when it was created and why the duplicated files in this directory have another content.
Accepting my own post as answer to indicate that the issue can be solved.
i try to create some small project on windows, but when i try to build this with cmake there are many errors occured. On linux this build up successfully. When i create dummy project with CMake all work. This is my folder structure:
extern
googletest
tests
...
CMakeLists.txt
...
CMakeLists.txt
Root CMakeLists.txt:
# Setup cmake minimal required version
cmake_minimum_required(VERSION 3.10)
# Declare project
project(mobile_speaker_driver)
# Change c++ standard
set(CMAKE_CXX_STANDARD 17)
# Adding googletest to project
option(PACKAGE_TESTS "Build the tests" ON)
if(PACKAGE_TESTS)
enable_testing()
include(GoogleTest)
add_subdirectory(tests)
endif()
# Add source files to driver library
if (WIN32)
set(SOURCE_FILES apps/main.cpp src/AudioDriver.cpp src/AudioDriverWindows.cpp)
elseif (UNIX)
set(SOURCE_FILES apps/main.cpp src/AudioDriver.cpp src/AudioDriverLinux.cpp)
endif (WIN32)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
Tests CMakeLists.txt:
set(TESTBINARY ${PROJECT_NAME}_test)
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/googletest" "extern/googletest")
add_executable(${TESTBINARY} main.cpp AudioDriverTest.cpp)
target_link_libraries(${TESTBINARY} gtest gtest_main)
Errors:
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h: In function 'int testing::internal::posix::StrCaseCmp(const char*, const char*)':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h:1985:10: error: '_stricmp' was not declared in this scope; did you mean 'strncmp'?
1985 | return _stricmp(s1, s2);
| ^~~~~~~~
| strncmp
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h: In function 'char* testing::internal::posix::StrDup(const char*)':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h:1987:47: error: '_strdup' was not declared in this scope
1987 | inline char* StrDup(const char* src) { return _strdup(src); }
| ^~~~~~~
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h: In function 'int testing::internal::posix::FileNo(FILE*)':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h:1995:40: error: '_fileno' was not declared in this scope; did you mean 'file'?
1995 | inline int FileNo(FILE* file) { return _fileno(file); }
| ^~~~~~~
| file
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h: In function 'FILE* testing::internal::posix::FDOpen(int, const char*)':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/include/gtest/internal/gtest-port.h:2072:56: error: 'fdopen' was not declared in this scope; did you mean 'fopen'?
2072 | inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
| ^~~~~~
| fopen
In file included from D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-all.cc:41:
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest.cc: In static member function 'static bool testing::internal::String::CaseInsensitiveWideCStringEquals(const wchar_t*, const wchar_t*)':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest.cc:2077:10: error: '_wcsicmp' was not declared in this scope; did you mean 'wcsncmp'?
2077 | return _wcsicmp(lhs, rhs) == 0;
| ^~~~~~~~
| wcsncmp
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest.cc: In member function 'int testing::UnitTest::Run()':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest.cc:5253:21: error: '_OUT_TO_STDERR' was not declared in this scope
5253 | _set_error_mode(_OUT_TO_STDERR);
| ^~~~~~~~~~~~~~
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest.cc:5253:5: error: '_set_error_mode' was not declared in this scope
5253 | _set_error_mode(_OUT_TO_STDERR);
| ^~~~~~~~~~~~~~~
In file included from D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-all.cc:42:
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc: In function 'void testing::internal::DeathTestAbort(const string&)':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc:296:5: error: '_exit' was not declared in this scope; did you mean '_cexit'?
296 | _exit(1);
| ^~~~~
| _cexit
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc: In member function 'virtual void testing::internal::DeathTestImpl::Abort(testing::internal::DeathTest::AbortReason)':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc:527:3: error: '_exit' was not declared in this scope; did you mean '_cexit'?
527 | _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
| ^~~~~
| _cexit
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc: In member function 'virtual testing::internal::DeathTest::TestRole testing::internal::WindowsDeathTest::AssumeRole()':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc:771:24: error: '_MAX_PATH' was not declared in this scope; did you mean 'MAX_PATH'?
771 | char executable_path[_MAX_PATH + 1]; // NOLINT
| ^~~~~~~~~
| MAX_PATH
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc:773:65: error: 'executable_path' was not declared in this scope
773 | executable_path,
| ^~~~~~~~~~~~~~~
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc:308:38: note: in definition of macro 'GTEST_DEATH_TEST_CHECK_'
308 | if (!::testing::internal::IsTrue(expression)) { \
| ^~~~~~~~~~
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc:797:11: error: 'executable_path' was not declared in this scope
797 | executable_path, const_cast<char*>(command_line.c_str()),
| ^~~~~~~~~~~~~~~
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-death-test.cc:308:38: note: in definition of macro 'GTEST_DEATH_TEST_CHECK_'
308 | if (!::testing::internal::IsTrue(expression)) { \
| ^~~~~~~~~~
In file included from D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-all.cc:43:
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-filepath.cc: In static member function 'static testing::internal::FilePath testing::internal::FilePath::GetCurrentDir()':
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-filepath.cc:49:26: error: '_MAX_PATH' was not declared in this scope; did you mean 'MAX_PATH'?
49 | # define GTEST_PATH_MAX_ _MAX_PATH
| ^~~~~~~~~
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-filepath.cc:101:12: note: in expansion of macro 'GTEST_PATH_MAX_'
101 | char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
| ^~~~~~~~~~~~~~~
D:/Projects/mobile-speaker-driver/extern/googletest/googletest/src/gtest-filepath.cc:102:27: error: 'cwd' was not declared in this scope
102 | return FilePath(_getcwd(cwd, sizeof(cwd)) == nullptr ? "" : cwd);
| ^~~
make.exe[2]: *** [tests/extern/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Ошибка 1
make.exe[1]: *** [tests/extern/googletest/googletest/CMakeFiles/gtest.dir/all] Ошибка 2
make.exe: *** [all] Ошибка 2
The problem is occured because i force build googletest with c++17 flags. Just place CMAKE_CXX_STANDARD after googletest include in main CMakeLists.txt.