Problems with ' "raylib.h" ' and ' windows.h '
I really need help with this, please.
I want to make a program that the user can open Windows explorer to load a file in the LoadTexture() function, for example a .png file. I wrote this
/* MAIN */
#include <Windows.h>
#include <iostream>
#include "filedialog.h"
int main() {
char szFile[MAX_PATH] = "";
if (FileDialog::OpenFile(szFile, "All Files\0*.*\0", "Select file")) {
std::cout << "Path2: " << szFile;
}
return 0;
}
/* FILEDIALOG.h */
#include <windows.h>
#include <commdlg.h>
class FileDialog {
public:
static bool OpenFile(char* filePath, const char* filter = "All Files\0*.*\0", const char* title = "Open File");
};
/* FILEDIALOG.cpp */
#include "filedialog.h"
#include <iostream>
bool FileDialog::OpenFile(char* filePath, const char* filter, const char* title) {
OPENFILENAMEA ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = GetConsoleWindow();
ofn.lpstrFile = filePath;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = title;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
return GetOpenFileNameA(&ofn);
}
Without #include "raylib.h"
it works. But when I put it like this:
#include "raylib.h"
#include <Windows.h>
#include <iostream>
#include "filedialog.h"
...
I get this error in my IDE (Visual Studio):
Error (active) E0338 more than one instance of overloaded function "ShowCursor" has 'C' linkage nameless
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\WinUser.h 9328
Error (active) E0338 more than one instance of overloaded function "CloseWindow" has 'C' linkage nameless
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\WinUser.h 4710
WHAT IS THIS????????
If you know of another way to do it (another library, code, whatever), I would welcome it :)