Problems with Running MySQL Connector in CLion - c++

I've recently installed MySQL Connector for CLion as I am planning to make a program that would MySQL Databases. I've installed the Connector from the mysql website and tried the code that is provided by the website. After running it, I found that it says that boost/shared_ptr.hpp does not exist. So I went to download boost version 1.66.0 and installed it into my C drive. I also added these directories into my Cmake file but they still showed errors.
This is my Cmake File:
cmake_minimum_required(VERSION 3.8)
project(Learn_Cpp)
set(CMAKE_CXX_STANDARD 17)
LINK_DIRECTORIES(C:/Program Files/MySQL/MySQL Connector)
LINK_DIRECTORIES(C++ 1.1.9/include C:/Boost/boost_1_66_0)
include_directories("C:/Program Files/MySQL/MySQL Connector C++ 1.1.9/include" "C:/Boost/boost_1_66_0")
set(SOURCE_FILES "C++ Tutorials/Learn.cpp" "C++ Tutorials/ClassFile.cpp" "C++ Tutorials/ClassFile.h" "C++ Tutorials/Learn.cpp")
add_executable(Learn_Cpp ${SOURCE_FILES})
I tried resolving this issue and another error showed up that I do not have a user.hpp file in boost/config.
Here is the error message:
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" --build C:\Users\Timothy\CLionProjects\Learn_Cpp\cmake-build-debug --target all -- -j 4
[ 33%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj
In file included from C:/Boost/boost_1_66_0/boost/smart_ptr/shared_ptr.hpp:17:0,
from C:/Boost/boost_1_66_0/boost/shared_ptr.hpp:17,
from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/mysql_connection.h:31,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:9:
C:/Boost/boost_1_66_0/boost/config.hpp:30:29: fatal error: boost/config/user.hpp: No such file or directory
# include BOOST_USER_CONFIG
^
compilation terminated.
CMakeFiles\Learn_Cpp.dir\build.make:62: recipe for target 'CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj' failed
mingw32-make.exe[2]: *** [CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/Learn_Cpp.dir/all] Error 2
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/Learn_Cpp.dir/all' failed
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
Anyone who could provide a solution to this will be greatly appreciated. Thanks.
UPDATE:
I resolved the error "user.hpp" but I got another error message, this time regarding int32_t and uint32_t. I have no idea what these are or how to resolve this issue.
This is the error message now:
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" --build C:\Users\Timothy\CLionProjects\Learn_Cpp\cmake-build-debug --target Learn_Cpp -- -j 4
Scanning dependencies of target Learn_Cpp
[ 25%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/ClassFile.cpp.obj
[ 75%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj
[ 75%] Building CXX object CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Classes_and_simple_prgm.cpp.obj
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/resultset.h:30:0,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:13:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:95:19: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/resultset.h:30:0,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:13:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:99:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/statement.h:30:0,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:14:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:95:19: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/statement.h:30:0,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:14:
C:/PROGRA~1/MySQL/MYSQLC~1.9/include/cppconn/config.h:99:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from C:\Users\Timothy\CLionProjects\Learn_Cpp\C++ Tutorials\Learn.cpp:5:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~
mingw32-make.exe[3]: *** [CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj] Error 1
mingw32-make.exe[3]: *** Waiting for unfinished jobs....
CMakeFiles\Learn_Cpp.dir\build.make:87: recipe for target 'CMakeFiles/Learn_Cpp.dir/C++_Tutorials/Learn.cpp.obj' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/Learn_Cpp.dir/all' failed
mingw32-make.exe[2]: *** [CMakeFiles/Learn_Cpp.dir/all] Error 2
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/Learn_Cpp.dir/rule' failed
mingw32-make.exe[1]: *** [CMakeFiles/Learn_Cpp.dir/rule] Error 2
mingw32-make.exe: *** [Learn_Cpp] Error 2
Makefile:117: recipe for target 'Learn_Cpp' failed

Related

How to solve this [All] Error 2 in this case?

So I coding a simple tensor with Eigen as follows:
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <Eigen/Dense>
#include <unsupported/Eigen/CXX11/Tensor>
using namespace Eigen;
using namespace std;
int main () {
Tensor<double, 3> A(4,5,6); // 3 dimensions (4x5x6)
A.setZero();
A(0,1,2) = 1.7;
A(1,2,2) = -1.5;
cout<<A(1,2,2)<<endl;
return 0;
}
But then I get the following error and I looked around the internet for help, but sadly I am still clueless. I always get this error with my more advanced code, so I decided to do a small code just to test when I get this error. Note: I didn't get this error when I was did the same with an Eigen matrix. Only when I changed to a tensor, did I get this error. Then afterwards I changed it back to a matrix and I somehow get the same error now? However, even in my more advanced code I don't even have any tensors, but for some reason still get this error. Can someone please help me as this is driving me insane?
C:\WINDOWS\system32\cmd.exe /C C:/MinGW/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ Test - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test'
mingw32-make.exe[1]: Leaving directory 'C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test'
mingw32-make.exe[1]: Entering directory 'C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test'
C:/MinGW/bin/g++.exe -c "C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test/main.cpp" -std=c++14 -Wall -g -O0 -Wall -o ./Debug/main.cpp.o -I. -I"C:\Users\RS3\Desktop\SCC HiWi\Code\C++\myGmm\UQ\eigen-3.3.9" -I"C:\Users\RS3\Desktop\SCC HiWi\Code\C++\myGmm\UQ\Halton" -I"C:\Users\RS3\Desktop\SCC HiWi\Code\C++\myGmm\UQ\quasimvnrnd" -I"C:\Users\RS3\Desktop\SCC HiWi\Code\C++\myGmm\UQ\dirent\dirent-master\include"
In file included from C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test/main.cpp:5:
C:\Users\RS3\Desktop\SCC HiWi\Code\C++\myGmm\UQ\eigen-3.3.9/unsupported/Eigen/CXX11/Tensor:53:17: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\stdint.h:9,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\char_traits.h:501,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iostream:39,
from C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test/main.cpp:2:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test/main.cpp:5:
C:\Users\RS3\Desktop\SCC HiWi\Code\C++\myGmm\UQ\eigen-3.3.9/unsupported/Eigen/CXX11/Tensor:54:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\stdint.h:9,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\char_traits.h:501,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:40,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iostream:39,
from C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test/main.cpp:2:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~
mingw32-make.exe[1]: *** [Debug/main.cpp.o] Error 1
Test.mk:97: recipe for target 'Debug/main.cpp.o' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/RS3/Desktop/SCC HiWi/Code/C++/myGmm/UQ/Test'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====1 errors, 4 warnings====
UPDATE: When I remove the last include and do the Eigen matrix again, there's no problem. So the problem is with the last include. But without it, I can't work with tensors. What should I do to work with tensors without the error?
Can you let us know where your version of MinGW comes from?
The issue is that your version of MinGW is apparently defining __int32 as long but int32_t as int, leading to a type conflict. We had some code in the Tensor module to ensure int32_t is always defined on Windows, since Visual Studio prior to 2010 doesn't actually provide an stdint.h header. We've never seen this cause an issue before. I tried several versions of MinGW, both 32-bit and 64-bit, but in all the ones I've tried so far __int32 is always an int.
I have a potential fix pending on the master branch here: !373. Once it's merged we can backport the change to the stable 3.3 branch.
If you just want to get something up and running, you can try installing a different version of MinGW.

How do I start to debug “recipe for target 'all' failed” When compiling a C ++ Library

Any tips on where I can start bugging this would be great.
I'm not sure where to start
I'm building this Library Unmodified using CMake and MinGW,
I'm getting a series of warnings about deprecated code being used but as I haven't developed this code I don't know about modifying it to remove those, and since they're warnings not errors I'm not sure if this is necessary.
C:\Users\user\Desktop\ccfits3\CCfits\FITS.cxx: In constructor 'CCfits::FITS::FITS(const String&, CCfits::RWmode, bool, const std::vector<std::__cxx11::basic_string<char> >&)':
C:\Users\user\Desktop\ccfits3\CCfits\FITS.cxx:91:11: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr<FITSBase> apBase(new FITSBase(name,mode));
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\locale_conv.h:41:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\locale:43,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iomanip:43,
from C:\Users\user\Desktop\ccfits3\CCfits\KeyData.h:20,
from C:\Users\user\Desktop\ccfits3\CCfits\KeywordCreator.h:13,
from C:\Users\user\Desktop\ccfits3\CCfits\NewKeyword.h:13,
from C:\Users\user\Desktop\ccfits3\CCfits\HDU.h:21,
from C:\Users\user\Desktop\ccfits3\CCfits\ExtHDU.h:15,
from C:\Users\user\Desktop\ccfits3\CCfits\Table.h:13,
from C:\Users\user\Desktop\ccfits3\CCfits\FITS.cxx:10:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\unique_ptr.h:49:28: note: declared here
template<typename> class auto_ptr;
^~~~~~~~
C:\Users\user\Desktop\ccfits3\CCfits\FITS.cxx: In constructor 'CCfits::FITS::FITS(const String&, CCfits::RWmode, const string&, bool, const std::vector<std::__cxx11::basic_string<char> >&, const std::vector<std::__cxx11::basic_string<char> >&, int)':
C:\Users\user\Desktop\ccfits3\CCfits\FITS.cxx:147:16: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr<FITSBase> apBase(new FITSBase(name,mode));
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\locale_conv.h:41:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\locale:43,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iomanip:43,
from C:\Users\user\Desktop\ccfits3\CCfits\KeyData.h:20,
from C:\Users\user\Desktop\ccfits3\CCfits\KeywordCreator.h:13,
from C:\Users\user\Desktop\ccfits3\CCfits\NewKeyword.h:13,
from C:\Users\user\Desktop\ccfits3\CCfits\HDU.h:21,
from C:\Users\user\Desktop\ccfits3\CCfits\ExtHDU.h:15,
from C:\Users\user\Desktop\ccfits3\CCfits\Table.h:13,
from C:\Users\user\Desktop\ccfits3\CCfits\FITS.cxx:10:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\unique_ptr.h:49:28: note: declared here
template<typename> class auto_ptr;
^~~~~~~~
at the end of the build process, I get the error
"C:\Program Files\JetBrains\CLion 2020.2.4\bin\cmake\win\bin\cmake.exe" --build
C:\Users\user\Desktop\cfits2\CCfits\debug --target all -- -j 3
mingw32-make.exe[2]: *** [libCCfits.a] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/CCfits.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
CMakeFiles\CCfits.dir\build.make:375: recipe for target 'libCCfits.a' failed
CMakeFiles\Makefile2:96: recipe for target 'CMakeFiles/CCfits.dir/all' failed
Makefile:159: recipe for target 'all' failed
I don't know where to go from here what's my next step in the still bugging process.
the error really doesn't seem to tell me anything useful, and the warnings are probably unrelated I think.
I don't think I can get rid of the warnings without a deeper understanding of the library.
thank you please forgive the stupid question

GTest - isatty not declared in this scope

I've spent hours trying to figure out why I'm getting the following compiling error:
~/src/example/build $ make
-- Downloading GMock / GTest version 1.8.0 from git
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/src/example/build
[ 5%] Performing update step for 'gmock'
[ 10%] Performing configure step for 'gmock'
-- gmock configure command succeeded. See also /home/user/src/example/build/gmock/src/gmock-stamp/gmock-configure-*.log
[ 15%] Performing build step for 'gmock'
-- gmock build command succeeded. See also /home/user/src/example/build/gmock/src/gmock-stamp/gmock-build-*.log
[ 20%] No install step for 'gmock'
[ 25%] Completed 'gmock'
[ 40%] Built target gmock
[ 75%] Built target project-app
Scanning dependencies of target step_definition_runner
[ 80%] Building CXX object Target/project/CMakeFiles/step_definition_runner.dir/features/step_definitions/App_Steps.cpp.o
In file included from /home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-internal.h:40:0,
from /home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/gtest.h:58,
from /home/user/src/example/Target/project/features/step_definitions/App_Steps.cpp:1:
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::IsATTY(int)’:
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h:2341:45: error: ‘isatty’ was not declared in this scope
inline int IsATTY(int fd) { return isatty(fd); }
^
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::RmDir(const char*)’:
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h:2347:53: error: ‘rmdir’ was not declared in this scope
inline int RmDir(const char* dir) { return rmdir(dir); }
^
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::ChDir(const char*)’:
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h:2365:53: error: ‘chdir’ was not declared in this scope
inline int ChDir(const char* dir) { return chdir(dir); }
^
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::Read(int, void*, unsigned int)’:
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h:2379:46: error: ‘read’ was not declared in this scope
return static_cast<int>(read(fd, buf, count));
^
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::Write(int, const void*, unsigned int)’:
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h:2382:47: error: ‘write’ was not declared in this scope
return static_cast<int>(write(fd, buf, count));
^
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::Close(int)’:
/home/user/src/example/build/gmock/src/gmock/googletest/include/gtest/internal/gtest-port.h:2384:43: error: ‘close’ was not declared in this scope
inline int Close(int fd) { return close(fd); }
^
Target/project/CMakeFiles/step_definition_runner.dir/build.make:62: recipe for target 'Target/project/CMakeFiles/step_definition_runner.dir/features/step_definitions/App_Steps.cpp.o' failed
make[2]: *** [Target/project/CMakeFiles/step_definition_runner.dir/features/step_definitions/App_Steps.cpp.o] Error 1
CMakeFiles/Makefile2:164: recipe for target 'Target/project/CMakeFiles/step_definition_runner.dir/all' failed
make[1]: *** [Target/project/CMakeFiles/step_definition_runner.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2
I'm using the FindGMock.cmake from the cucumber-cpp project to handle the GTest dependency.
In my CMakeLists.txt file I have:
add_executable(step_definition_runner
features/step_definitions/App_Steps.cpp
)
target_include_directories(step_definition_runner
PRIVATE
${GTEST_INCLUDE_DIRS}
)
target_link_libraries(step_definition_runner project-app ${GTEST_LIBRARIES})
I've tried many things, but a couple of note:
Including unistd.h before I include gtest/gtest.h.
Force including unistd.h inside gtest/gtest.h and gtest/internal/gtest-port.h.
Is there something obvious I'm missing?
It seems like you are not on windows OS.
These functions are allowed only for windows
Look for below content in
https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h
402 // Brings in definitions for functions used in the testing::internal::posix
403 // namespace (read, write, close, chdir, isatty, stat). We do not currently
404 // use them on Windows Mobile.
405 #if GTEST_OS_WINDOWS
406 # if !GTEST_OS_WINDOWS_MOBILE
407 # include <direct.h>
408 # include <io.h>
409 # endif

make opencv on windows,get a error

I using cmake and mingw-w64 to make opencv on windows 10,however,i get a error when make it on 97%.
there are error report:
[ 96%] Built target opencv_videostab
[ 97%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj
In file included from C:/PROGRA~1/Python36/include/Python.h:8:0,
from D:\Program Files (x86)\OpenCv_3.2.0\opencv\sources\modules\python\src2\cv2.cpp:6:
C:/PROGRA~1/Python36/include/pyconfig.h:379:5: warning: "_MSC_VER" is not defined, evaluates to 0 [-Wundef]
#if _MSC_VER >= 1800
^~~~~~~~
In file included from D:/Program Files (x86)/MinGw_64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/math.h: 36:0,
from C:/PROGRA~1/Python36/include/pyport.h:194,
from C:/PROGRA~1/Python36/include/Python.h:50,
from D:\Program Files (x86)\OpenCv_3.2.0\opencv\sources\modules\python\src2\cv2.cpp:6:
D:/Program Files (x86)/MinGw_64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/cmath:42:10: fatal error: D:/ Program Files (x86)/MinGw_64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/bits/cpp_type_traits.h>: Invalid argument
#include <bits/cpp_type_traits.h>s
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
mingw32-make[2]: ***[modules\python3\CMakeFiles\opencv_python3.dir\build.make:180: modules/python3/CMakeFiles/ope ncv_python3.dir/__/src2/cv2.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:6794: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
mingw32-make: *** [Makefile:160: all] Error 2
What can i do to slove it?
update:
i had sloved it,it's a bug fot mingww64,the error erport
:cmath:42:10: fatal error: D:/ Program Files (x86)/MinGw_64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/bits/cpp_type_traits.h>: Invalid argument #include <bits/cpp_type_traits.h>s
said having a error to head file,so i just delete the 's' after include statement,that is include <bits/cpp_type_traits.h>

OpenCV "conflicting declaration" issue at compilation on armv7l (Odroid XU4)

I'm trying to compile OpenCV 3.4.0 from sources but I'm running into a conflicting declaration issue between QT and OpenGL.
Upgrading from QT4 to QT5 solved some issues but not all.
It looks like GLsizeiptr and GLintptr are declared in both the OpenGL headers and the QT headers.
I tried to replace
#include <GL/glx.h>
with
#include <GLES3/gl3.h>
in window_QT.cpp but that only created more declaration issues.
Any ideas on how to fix that?
(My machine is an armv7l (Odroid XU4) running Ubuntu 16.04.3 LTS)
The cmake command I'm running:
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_QT=5 -DWITH_OPENGLES=ON -DWITH_V4L=ON -DWITH_TBB=ON -DBUILD_TBB=ON -DENABLE_VFPV3=ON -DENABLE_NEON=ON ..
make -j8
the errors I'm getting:
[ 62%] Built target opencv_videoio
[ 63%] Built target opencv_superres
[ 63%] Building CXX object
modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o
cc1plus: warning: /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/release/modules/highgui/precomp.hpp.gch/opencv_highgui_RELEASE.gch: not used because `TBB_USE_GCC_BUILTINS' is defined [-Winvalid-pch]
In file included from /usr/include/GL/gl.h:2055:0,
from /usr/include/GL/glx.h:32,
from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:59:
/usr/include/GL/glext.h:466:19: error: conflicting declaration ‘typedef ptrdiff_t GLsizeiptr’
typedef ptrdiff_t GLsizeiptr;
^
In file included from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopengl.h:95:0,
from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopenglcontext.h:54,
from /usr/include/arm-linux-gnueabihf/qt5/QtGui/QtGui:32,
from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGLDepends:4,
from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGL:3,
from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.h:50,
from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:47:
/usr/include/GLES3/gl31.h:77:25: note: previous declaration as ‘typedef khronos_ssize_t GLsizeiptr’
typedef khronos_ssize_t GLsizeiptr;
^
In file included from /usr/include/GL/gl.h:2055:0,
from /usr/include/GL/glx.h:32,
from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:59:
/usr/include/GL/glext.h:467:19: error: conflicting declaration ‘typedef ptrdiff_t GLintptr’
typedef ptrdiff_t GLintptr;
^
In file included from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopengl.h:95:0,
from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopenglcontext.h:54,
from /usr/include/arm-linux-gnueabihf/qt5/QtGui/QtGui:32,
from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGLDepends:4,
from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGL:3,
from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.h:50,
from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:47:
/usr/include/GLES3/gl31.h:78:26: note: previous declaration as ‘typedef khronos_intptr_t GLintptr’
typedef khronos_intptr_t GLintptr;
^
[ 63%] Built target gen_opencv_python_source
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:129: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o' failed
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o] Error 1
CMakeFiles/Makefile2:5307: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
Thanks for the help!
Problem solved: I just tried a fresh install with latest version of opencv cloned directly from github and the install went flawlessly.