I'm trying to compile and run the following code:
#include <iostream>
#include <SDL.h>
#include <SDL_net.h>
#include <cstring>
using namespace std;
int main(int argc, char **argv)
{
printf("result of SDL_Init is: %i\n",SDL_Init(SDL_INIT_EVERYTHING));
printf("result of SDLNet_Init is: %i\n",SDLNet_Init());
}
The code compiles fine, but when I run it I get an error:
The application was unable to start correctly (0xc000007b). Click OK to close the application
I've successfully compiled and run SDL code before, but this is my first time trying out SDL_Net.
I'm using Code::Blocks on Windows with MinGW GCC compiler, I'm using the x86_64-w64-mingw32 libraries for SDL, and these are my linker settings (some of which are not immediately necessary, I know):
-lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lpthread -lSDL2_net
Does anyone know what's going on here?
//ETA:
How can I resolve this issue without switching all my stuff over to 32-bit?
Thanks,
I solved the issue by the following:
Installed mingw-w64 instead of mingw32 and set that as my compiler. I had to change most of the toolchain executables so that they pointed to files with "x86_64-w64-mingw32-" in the name (for example, "gcc.exe" was changed to "x86_64-w64-mingw32-gcc.exe"). the Resource Compiler and Make program names were unchanged.
Using the binaries in the x86_x64-mingw32 folder of the SDL_Net development library did not work. I had to replace them with the SDL2_net-2.0.1-win32-x64 runtime binaries that you can download directly on the SDL_Net homepage.
//Note: Maybe the "i686-w64-mingw32" development library binaries would have worked... I didn't test it. I always get confused when "64" is prefaced by "86" and "686", and in the case of these dev libraries, the other option is "x86_64-w64-mingw32".... so which one is really x64, and which one is x32? Not sure.
//Note: I don't actually fully understand what "-Wl,-Bstatic" and "-Wl,-Bdynamic" do. I wish someone would explain that to me.
I hope this helps somebody!