I use mingw and CLion to run the examples.
In file included from c:\mingw\include\windows.h:48,
from D:\raylib-master\raylib-master\src\external/miniaudio.h:3034,
from D:\raylib-master\raylib-master\src\raudio.c:82:
c:\mingw\include\winuser.h:3519:25: error: conflicting types for 'CloseWindow'
WINUSERAPI BOOL WINAPI CloseWindow (HWND);
^~~~~~~~~~~
In file included from D:\raylib-master\raylib-master\src\raudio.c:72:
D:\raylib-master\raylib-master\src\raylib.h:897:12: note: previous declaration of 'CloseWindow' was here
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
^~~~~~~~~~~
In file included from c:\mingw\include\windows.h:48,
from D:\raylib-master\raylib-master\src\external/miniaudio.h:3034,
from D:\raylib-master\raylib-master\src\raudio.c:82:
c:\mingw\include\winuser.h:4284:23: error: conflicting types for 'ShowCursor'
WINUSERAPI int WINAPI ShowCursor (BOOL);
^~~~~~~~~~
In file included from D:\raylib-master\raylib-master\src\raudio.c:72:
D:\raylib-master\raylib-master\src\raylib.h:924:12: note: previous declaration of 'ShowCursor' was here
RLAPI void ShowCursor(void); // Shows cursor
^~~~~~~~~~
In file included from D:\raylib-master\raylib-master\src\raudio.c:72:
D:\raylib-master\raylib-master\src\raylib.h:142:21: error: conflicting types for 'UnhideWindow'
#define ShowWindow UnhideWindow
^~~~~~~~~~~~
In file included from D:\raylib-master\raylib-master\src\raudio.c:72:
D:\raylib-master\raylib-master\src\raylib.h:903:12: note: previous declaration of 'UnhideWindow' was here
RLAPI void UnhideWindow(void); // Show the window
^~~~~~~~~~~~
It shouldn't happen. Are you building raylib as 64 bit? Using latest version from GitHub? Using MinGW-w64 32 bit or 64 bit? Using Windows 10 or a virtual machine?
OS: windows 10
Version: master
compiler: mingw32
Try using mingw32-w64. It seems issue could also be CLion related. Closing it in the meantime, as continuous integration works.
It works with mingw64, finally!! 馃
Same issue for me when I attempt to build raylib with make from command prompt.
win10, mingw32 32 bit.
I do not intend to install 64 bit mingw.
Note that Makefile L22 CC ?= gcc results The system cannot find the file specified. error. That could be fixed with CC = gcc, but that won't prevent this issue to happen for raudio.c.
If mingw32 is not supported, can I request that the web documentation be updated to reflect that mingw64 is required? Also, it would be helpful to change the title of this issue to mingw64 is required on windows. Thank you!
I came across this issue when trying to compile with Mingw32 using cmake -G 'MSYS Makefiles' ..
The problem is that raudio.c pulls in Win32's windows.h through miniaudio.h, causing the Win32 CloseWindow and ShowCursor definitions to conflict with the Raylib definitions of those functions.
I see that raudio.c has these lines before #include <windows.h> to get rid of the unwanted function definitions:
// If defined, the following flags inhibit definition of the indicated items.
#define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
#define NOVIRTUALKEYCODES // VK_*
#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
#define NOWINSTYLES // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
// ...
but Mingw32's windows.h and related headers does not do anything with these #defines. AFAICT this is why it compiles with Mingw64 but not with Mingw32.
It seems that the best way to get raudio.c compiled is to tell it to use the raudio.h standalone header, by putting this block right at the top of the file:
#if defined(__MINGW32__) && !defined(__MINGW64__)
# define RAUDIO_STANDALONE
# define USING_MINGW32
void SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite);
#endif
It tries to check whether it is being built with Mingw32 and not Mingw64 (based on this answer), and then declares RAUDIO_STANDALONE to use raudio.h rather than raylib.h. It seems that the function SaveFileData is referenced in raudio.c but not declared in raudio.h, so I also put a prototype in this block.
Then right at the bottom of the file you need to modify the block that creates the IsFileExtension function when RAUDIO_STANDALONE to not do it if USING_MINGW32 is defined. The body of SaveFileData should probably go into this #if block as well, but I didn't go so far.
// Some required functions for audio standalone module version
#if defined(RAUDIO_STANDALONE) && !defined(USING_MINGW32)
// Check file extension
bool IsFileExtension(const char *fileName, const char *ext)
{
// ...snip...
}
#endif
Unfortunately, this only gets it compiled. With the exception of audio_raw_stream.exe, none of the audio examples actually seem to play sounds, and the logs don't provide any clues as to why. It doesn't crash or anything, there's just silence.
Still having this issue. Using raylib 3.0.0 (01 April 2020) with spdlog and having error "UnhideWindow can't override function with C binding" (C2733) at Visual Studio Community 2019, 16.6.1,
I've found much better results with window, when using the windows subsystem for linux
This does not encumber your exe with a dependency (other than possibly a single gcc dll which can be packaged with the exe (WSL does not do graphics or opengl or sound or anything else other than provide a build environment)
The Linux build tools when used in windows, give a much easier build environment, allowing the use of make and is generally a lot fraught with issues...
There are a number of misconceptions about using this build environment so I ended up blogging about it
http://bedroomcoders.co.uk/creating-a-64-bit-executable-with-raylib-on-windows/
alas I found I needed to blog again to clear up further misconceptions !
http://bedroomcoders.co.uk/looking-again-at-compiling-a-windows-raylib-app/
using mingw-32 to create a 32-bit windows exe - is using a compiler ported from another OS, rather easier just to run gcc from a WSL command prompt (bash!) using this method it is also possible to use the same cross compiler packages from Linux to create windows exes.... fantastic no need to boot the toyOS box !!
Still having this issue. Using raylib 3.0.0 (01 April 2020) with spdlog and having error "UnhideWindow can't override function with C binding" (C2733) at Visual Studio Community 2019, 16.6.1,
what example are you trying to build ?
Still having this issue. Using raylib 3.0.0 (01 April 2020) with spdlog and having error "UnhideWindow can't override function with C binding" (C2733) at Visual Studio Community 2019, 16.6.1,
what example are you trying to build ?
I'm trying to build custom logging example. Here's my change:
#include "spdlog/spdlog.h"
// Custom logging funtion
void LogCustom(int msgType, const char* text, va_list args)
{
switch (msgType)
{
case LOG_INFO:
spdlog::info(TextFormat(text, args));
break;
default: break;
}
}
Most helpful comment
If mingw32 is not supported, can I request that the web documentation be updated to reflect that mingw64 is required? Also, it would be helpful to change the title of this issue to mingw64 is required on windows. Thank you!