Ask Your Question
0

Error: '_ReturnAddress' was not declared in this scope

asked 2019-01-03 02:05:49 -0600

onthegrid007 gravatar image

Hi, I am having an issue and any help is greatly appreciated. I am trying to compile OpenCV 4.0.1 using x86_64-8.1.0-posix-sjlj-rt_v6-rev0-mingw-w64 to use in the 12-2018-C++ Version of Eclipse

This is the main error I get during mingw32-make is run:

S:/SYSTEMS/CPP/OpenCV-4.0.1/sources/modules/core/include/opencv2/core/private.hpp:699:42: error: '_ReturnAddress' was not declared in this scope
 #define CV_INSTRUMENT_GET_RETURN_ADDRESS _ReturnAddress()
                                          ^~~~~~~~~~~~~~

And here it is from the beginning of object compilation, until mingw32-make quits from all the errors:

//Do note verbose and extra warnings are turned on so I can debug faster, but it does make more output and is harder to sort through sorry...

[ 34%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/core/src/arithm.cpp.obj
cd /d S:\SYSTEMS\CPP\OpenCV-4.0.1\MinGW-64\modules\world && S:\TOOLCHAINS\CPP\MinGW-w64\x86_64-8.1.0-posix-sjlj-rt_v6-rev0\bin\g++.exe  -DCVAPI_EXPORTS -DCV_OCL4DNN=1 -DHAVE_FFMPEG_WRAPPER=1 -DHAVE_IMGCODEC_HDR -DHAVE_IMGCODEC_PFM -DHAVE_IMGCODEC_PXM -DHAVE_IMGCODEC_SUNRASTER -DHAVE_PROTOBUF=1 -DHAVE_WEBP -DOPENCV_MODULE_IS_PART_OF_WORLD=1 -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS @CMakeFiles/opencv_world.dir/includes_CXX.rsp -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wcast-align -Wstrict-aliasing=2 -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong -fPIC -DSTRSAFE_NO_DEPRECATE -O2 -DNDEBUG  -DNDEBUG -D_FORTIFY_SOURCE=2   -std=c++11 -o CMakeFiles\opencv_world.dir\__\core\src\arithm.cpp.obj -c S:\SYSTEMS\CPP\OpenCV-4.0.1\sources\modules\core\src\arithm.cpp
In file included from S:/SYSTEMS/CPP/OpenCV-4.0.1/sources/modules/core/include/opencv2/core.hpp:58,
                 from S:/SYSTEMS/CPP/OpenCV-4.0.1/sources/modules/core/include/opencv2/core/utility.hpp:56,
                 from S:\SYSTEMS\CPP\OpenCV-4.0.1\sources\modules\core\src\precomp.hpp:49,
                 from S:\SYSTEMS\CPP\OpenCV-4.0.1\sources\modules\core\src\arithm.cpp:50:
S:/SYSTEMS/CPP/OpenCV-4.0.1/sources/modules/core/include/opencv2/core/types.hpp: In function 'cv::Scalar cv::operator*(const cv::Matx<_Tp, 4, 4>&, const Scalar&) [with _Tp = double; cv::Scalar = cv::Scalar_<double>]':
S:/SYSTEMS/CPP/OpenCV-4.0.1/sources/modules/core/include/opencv2/core/types.hpp:2419:45: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
     return reinterpret_cast<const Scalar&>(c);
                                             ^
In file included from S:\SYSTEMS\CPP\OpenCV-4.0.1\sources\modules\core\src\precomp.hpp:55,
                 from S:\SYSTEMS\CPP\OpenCV-4.0.1\sources\modules\core\src\arithm.cpp:50:
S:\SYSTEMS\CPP\OpenCV-4.0.1\sources\modules\core\src\arithm.cpp: In function 'void cv::bitwise_and(cv::InputArray, cv::InputArray, cv::OutputArray, cv::InputArray)':
S:/SYSTEMS/CPP/OpenCV-4.0.1/sources/modules/core/include/opencv2/core/private.hpp:699:42: error: '_ReturnAddress' was not declared in this scope
 #define CV_INSTRUMENT_GET_RETURN_ADDRESS _ReturnAddress()
                                          ^~~~~~~~~~~~~~
S:/SYSTEMS/CPP/OpenCV-4.0.1/sources/modules/core/include/opencv2/core/private.hpp:705:152: note: in expansion of macro 'CV_INSTRUMENT_GET_RETURN_ADDRESS'
 #define CV_INSTRUMENT_REGION_META(NAME, ALWAYS_EXPAND, TYPE, IMPL)        ::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, CV_INSTRUMENT_GET_RETURN_ADDRESS, ALWAYS_EXPAND, TYPE, IMPL);
                                                                                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
S:/SYSTEMS/CPP/OpenCV-4.0.1 ...
(more)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-01-03 02:49:57 -0600

berak gravatar image

updated 2019-01-03 03:00:05 -0600

if you want to use mingw, you have to set some special cmake flags:

ENABLE_INSTRUMENTATION=OFF             // your errors above (mingw can't compile it)
ENABLE_PRECOMPILED_HEADERS=OFF         // else the resource compiler crashes
WITH_MSMF=OFF                          // mingw is lacking some headers
CPU_DISPATCH=""                        // leave empty, (avx related runtime errors)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-01-03 02:05:49 -0600

Seen: 743 times

Last updated: Jan 03 '19