I'm trying to compile NRF driver with MinGW 4.8.2. I'm getting this error:
In file included from
b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/device/nrf51.h:119:0,
from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/softdevice/s130/headers/nrf_soc.h:50,
from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/nrf_soc.h:21,
from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/app_util_platform.h:26,
from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf/uart/app_uart.h:27,
from b:\nrfdriver\pc-ble-driver-0.5.0\driver\src\app_uart_pc.c:13:
C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.2/include/xmmintrin.h:
In function 'void _mm_setcsr(unsigned int)':
b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/core_cm0.h:164:21:
error: expected primary-expression before 'volatile' #define __I
volatile /*!< Defines 'read only' permissions */
^ driver\CMakeFiles\s130_nrf51_ble_driver.dir\build.make:297: recipe for
target 'driver/CMakeFiles/s130_nrf51_ble_driver.dir/src/app_uart_pc.c
.obj' failed
Error comes from this line:
#define __I volatile /*!< Defines 'read only' permissions */
How can such a simple #define lead to a compiler error and any idea how I should fix that? (upgrading the compiler is not an option as this version of the driver is supposed to be built with this version of MinGW).
Note that the driver is meant to be built in 32bits and I'm trying to build it targetting 64bits, dunno if that could be the cause of the problem...
What if we also look in the xmmintrin.h header?
/* Set the control register to I. */
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_setcsr (unsigned int __I)
{
__builtin_ia32_ldmxcsr (__I);
}
Ouch, another use of __I.
Related
Hello i tried to compile Assimp with mingw32.
But during compilation multiple errors appeard.
The first was:
C:\Users\MY_NAME\Downloads\assimp-5.0.1\assimp-5.0.1\code\SMD\SMDLoader.cpp:579:12: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
I found a solution for the this problem,i changed the source code and it worked but i don't found a solution for the second problem.
The second error was:
c:\users\MY_NAME\downloads\assimp-5.0.1\assimp-5.0.1\contrib\zip\src\zip.h:30:15: error: conflicting declaration 'typedef long int ssize_t'
30 | typedef long ssize_t; /* byte count or error */
here is line 30 from zip.h :
typedef long ssize_t; /* byte count or error */
To make it more clear,i decided to show you a block of code.
here is a block of code from line 27 to 31 in zip.h
#ifdef _WIN64
typedef long long ssize_t; /* byte count or error */
#else
typedef long ssize_t; /* byte count or error *
#endif
I'm using mingw32 with gcc (9.2.0)
Can someone explain why the build fail?
As far as I know, this issue is already closed in our current master. Could you please try the latest from Asset-Importer-Lib#github?
I installed ffmpeg according to this article. ffmpeg installation was ok.
Now I build opencv with ffmpeg support and I have some errors.
The errors are
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1484:21: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1512:30: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1686:35: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1920:32: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
^
In file included from /home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In static member function ‘static AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext*, AVCodecID, int, int, int, double, AVPixelFormat)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:2214:25: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:230: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o' failed
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1
CMakeFiles/Makefile2:2349: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed
What could be wrong?
My solution is to grep the missing defines (2 in total) from FFmpeg by using grep -r which leads to the following code found in libavcodec/avcodec.h:
#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020
Copy and paste it to the top of:
opencv-3.3.0/modules/videoio/src/cap_ffmpeg_impl.hpp
Compile and everything works even with the latest sources
Easiest change for the CODEC_FLAG_GLOBAL_HEADER is to change it to AV_CODEC_FLAG_GLOBAL_HEADER, it was redefined in a newer version.
Note the "AV_" in front
in opencv:0/2.4 there is no modules/videoio directory! to get that old version (2.4.13-r3) to compile with newest media-video/ffmpeg on gentoo (4.1.3) I had to add above changes to modules/highgui/src/cap_ffmpeg_api.hpp with this
patch:
--- opencv-2.4.13/modules/highgui/src/cap_ffmpeg_api.hpp 2019-05-27 13:28:05.736339890 +0200
+++ opencv-2.4.13-new/modules/highgui/src/cap_ffmpeg_api.hpp 2019-05-27 13:27:48.787198507 +0200
## -12,6 +12,10 ##
#define OPENCV_FFMPEG_API
#endif
+#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
+#define CODEC_FLAG_GLOBAL_HEADER
AV_CODEC_FLAG_GLOBAL_HEADER
+#define AVFMT_RAWPICTURE 0x0020
+
enum
{
CV_FFMPEG_CAP_PROP_POS_MSEC=0,
(i.e. I created the path and file /etc/portage/patches/media-libs/opencv-2.4.13-r3/old-ffmpeg.patch with that contents.)
in defense to gentoo, I should mention, the new media-libs/opencv:0/3.4.1 is also available, as is the old media-video/ffmpeg-3.4.5, so I could alternatively also play around with masking out versions or file a bug for developers to do that for me...
I am seeing this error trying to build a program on red hat 6
include/c++/4.9.2/limits:1558:7: internal compiler error: Illegal instruction
min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; }
^
Please submit a full bug report,
with preprocessed source if appropriate.
How do I fix this?
This depends on your compiler, but when I had this problem I did something like:
#ifndef _MSC_VER
#define _GLIBCXX_USE_NOEXCEPT _GLIBCXX_USE_NOEXCEPT
#else
#define _GLIBCXX_USE_NOEXCEPT
#endif
Unfortunately MSVS doesn't support noexcept.
I decided to use FMOD for sound playback in my project, but I'm getting lots of compiler errors which I am unsure of how to fix.
The header file of the class using FMOD looks more or less like this:
#ifndef PROJECTNAME_SOUNDMANAGER_H_
#define PROJECTNAME_SOUNDMANAGER_H_
#include <iostream>
#include <fmod.h>
#include <fmod.hpp>
#include <fmod_errors.h>
class SoundManager {
public:
static SoundManager &instance();
void play(char *data, size_t size, bool loop=false);
void stopAll();
private:
void ERRCHECK(FMOD_RESULT result);
SoundManager() : mSystem(nullptr) {
initFMOD();
}
SoundManager(const SoundManager &other);
SoundManager &operator=(const SoundManager &other);
void initFMOD();
FMOD::System *mSystem;
FMOD::Sound *mSound;
FMOD::Channel *mSoundChannel;
};
#endif // PROJECTNAME_SOUNDMANAGER_H_
And here are some of the compilation errors:
...../api/inc/fmod.h:1054:33: error: expected ')' before '*' token
...../api/inc/fmod.h:1056:33: error: expected ')' before '*' token
...../api/inc/fmod.h:1058:33: error: expected ')' before '*' token
...../api/inc/fmod.h:1059:33: error: expected ')' before '*' token
.....
...../api/inc/fmod.h:1465:5: error: 'FMOD_SOUND_PCMREADCALLBACK' does not name a type
...../api/inc/fmod.h:1466:5: error: 'FMOD_SOUND_PCMSETPOSCALLBACK' does not name a type
...../api/inc/fmod.h:1467:5: error: 'FMOD_SOUND_NONBLOCKCALLBACK' does not name a type
...../api/inc/fmod.h:1473:5: error: 'FMOD_FILE_OPENCALLBACK' does not name a type
.....
...../api/inc/fmod.h:1828:19: error: expected initializer before 'FMOD_Memory_GetStats'
...../api/inc/fmod.h:1829:19: error: expected initializer before 'FMOD_Debug_SetLevel'
...../api/inc/fmod.h:1830:19: error: expected initializer before 'FMOD_Debug_GetLevel'
...../api/inc/fmod.h:1831:19: error: expected initializer before 'FMOD_File_SetDiskBusy'
.....
...../api/inc/fmod.hpp:59:21: error: expected ';' at end of member declaration
...../api/inc/fmod.hpp:59:51: error: ISO C++ forbids declaration of 'release' with no type [-fpermissive]
...../api/inc/fmod.hpp:62:21: error: expected ';' at end of member declaration
...../api/inc/fmod.hpp:62:21: error: declaration of 'FMOD_RESULT FMOD::System::_stdcall'
...../api/inc/fmod.hpp:59:21: error: conflicts with previous declaration 'FMOD_RESULT FMOD::System::_stdcall'
...../api/inc/fmod.hpp:62:73: error: ISO C++ forbids declaration of 'setOutput' with no type [-fpermissive]
...../api/inc/fmod.hpp:63:21: error: expected ';' at end of member declaration
...../api/inc/fmod.hpp:63:21: error: declaration of 'FMOD_RESULT FMOD::System::_stdcall'
...../api/inc/fmod.hpp:59:21: error: conflicts with previous declaration 'FMOD_RESULT FMOD::System::_stdcall'
.....
If it makes any difference, I'm compiling with -std=c++0x.
I've tried searching but I wasn't able to find anything that helps me with these errors.
Please note that I'm using FMOD Ex 4.44.06.
EDIT: I seem to have found the problem. When I make a minimal example and compile it without -std=c++0x, everything compiles fine. However, if I add that flag, I get the same errors as with this project. Is there no way to make FMOD play nice with C++11?
My guess is that there's something defined as a macro or something not defined as a macro. Now, your task is to provide a minimal example. This can mean manually deleting large pieces of code or copying code from the header files. Do that until you can provide the offending code in a few lines. I guess that doing so, you will find the problem yourself.
There are a few things I noticed with the little code you provided:
fmod() is actually a function and I could imagine a few compilers providing this as a macro, which in turn conflicts with #include, but that doesn't seem to be your problem.
You include both fmod.h and fmod.hpp, which looks suspicious.
void ERRCHECK(FMOD_RESULT result); looks like a mix between function and macro.
play() should probably take a const char* data.
Under MSYS2 and GCC v5.4.0 I was facing the same problem.
The solution was add the compile flag -D__CYGWIN32__.
This is due the following in fmod.h:
#if defined(__CYGWIN32__)
#define F_CDECL __cdecl
#define F_STDCALL __stdcall
#define F_DECLSPEC __declspec
#define F_DLLEXPORT ( dllexport )
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
#define F_CDECL _cdecl
#define F_STDCALL _stdcall
#define F_DECLSPEC __declspec
#define F_DLLEXPORT ( dllexport )
...
I'm getting some strange error from within boost::asio when simply including the asio.hpp header file, which then includes other headers till win_static_mutex.ippwithin which it generates an conversion error.
I use MinGW with GCC 4.7 with the -std=gnu++11 compiler flag (see here why gnu++11 and not c++11). The error occurs in boost 1.49, 1.50 and 1.51 (current).
The full error reads as following:
In file included from boost1.49/boost/asio/detail/win_static_mutex.hpp:71:0,
from boost1.49/boost/asio/detail/static_mutex.hpp:23,
from boost1.49/boost/asio/detail/impl/signal_set_service.ipp:24,
from boost1.49/boost/asio/detail/signal_set_service.hpp:210,
from boost/asio/signal_set_service.hpp:19,
from boost/asio/basic_signal_set.hpp:24,
from boost/asio.hpp:26,
from MyCode\Client.cpp:3:
boost1.49/boost/asio/detail/impl/win_static_mutex.ipp: In member function 'int boost::asio::detail::win_static_mutex::do_init()':
boost1.49/boost/asio/detail/impl/win_static_mutex.ipp:51:63: error: invalid conversion from 'const wchar_t*' to 'size_t {aka unsigned int}' [-fpermissive]
boost1.49/boost/asio/detail/impl/win_static_mutex.ipp:51:63: error: invalid conversion from 'unsigned int' to 'const wchar_t*' [-fpermissive]
boost1.49/boost/asio/detail/impl/win_static_mutex.ipp:53:10: warning: declaration of 'mutex' shadows a global declaration [-Wshadow]
As I said in the beginning the only thing I do in my code is including the asio.hpp header:
#include <boost/asio.hpp>
The lines 43-53 from boost's win_static_mutex.ipp file are (I've marked the line 51):
using namespace std; // For sprintf.
wchar_t mutex_name[128];
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
swprintf_s(mutex_name, 128,
#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
swprintf(mutex_name,
#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p",
static_cast<unsigned int>(::GetCurrentProcessId()), this); // line 51
HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name);
Is there now some definitions I have to define or any other compiler flags or would one need to change something directly in boost or is it rather something with MinGW that needs to be changed?
It seems to be an error in Boost. You can try to update Boost to a later release (1.51 is available) and hope it's fixed there, otherwise you should report it as a bug.
One ugly 'solution' is to set the compiler flag -fpermissive.
At the moment I see only this 'solution' and one needs to wait until boost catches up again with GCC 4.7.0...