3

After a previous issue, I gave up and blew my installation away to start afresh. Reinstalling MinGW, Code Blocks (with MinGW) and SDL. Following this tutorial (http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php) to the letter. And every time I try to compile, no matter if the project is new or not, will suffer from the error message in the topic title.

I have tried this solution ("winapifamily.h: No such file or directory" when compiling SDL in Code::Blocks) and it still prevails. I have blown the installation to start again. I have now run out of options. Can anyone tell me why this is still happening?

I am using the latest versions of MinGW, SDL and Code Blocks.

Community
  • 1
  • 1
Jeremy Beare
  • 489
  • 3
  • 8
  • 22
  • I'm not sure why it happens, but if you use a version before 2.0.3 it should be fine without the solution. And if the solution works what is the problem? – Leonardo Apr 13 '14 at 13:21
  • The problem is I have tried it with AND without the solution. The problem still occurs no matter if I use the solution or not. – Jeremy Beare Apr 13 '14 at 13:22
  • Oh, sorry I thought you said the solution fixed it but that doesnt make sense. Try adding the path to all the subdirectories in `C:\Program Files (x86)\Windows Kits\8.0\Include` – Leonardo Apr 13 '14 at 13:24
  • Could I ask where I post these paths? And which subdirectories? – Jeremy Beare Apr 13 '14 at 13:26
  • Just add these paths to `build options -> search directories -> compiler` the folder paths to `shared` `um` and `winrt`. Although a subset of those may work too. – Leonardo Apr 13 '14 at 13:27
  • It didn't work. I tried the following For the Compiler - `C:\mingw_dev_lib\include\SDL2 C:\Program Files (x86)\Windows Kits\8.0\Include` For the Linker - `C:\mingw_dev_lib\lib C:\Program Files (x86)\Windows Kits\8.0\Lib` – Jeremy Beare Apr 13 '14 at 13:35
  • And also `C:\Program Files (x86)\Windows Kits\8.0\Include\shared` did not work either? – Leonardo Apr 13 '14 at 13:41
  • I'll put that into it and let you know in my next reply – Jeremy Beare Apr 13 '14 at 13:43
  • Adding the \shared didn't work either – Jeremy Beare Apr 13 '14 at 13:44

2 Answers2

5

How about hardcoding the include directory to your project? winapifamily.h should be on C:\Program Files (x86)\Windows Kits\8.0\Include\shared. You can add it to the "search directories" tab in project build options.

Make sure to check the file exist in the location first. If it doesn't, you may need to install windows 8 sdk.

Osod
  • 51
  • 2
0

If you go through that answer you posted there is the following option:

Go to your SDL_platform.h file located in the include/SDL2 directory of your library. Replace the code with the updated header file located here

Leonardo
  • 1,452
  • 3
  • 15
  • 26
  • I tried that .h file and it doesn't fix the problem – Jeremy Beare Apr 13 '14 at 13:38
  • @JeremyBeare This is troubling news. I would download an older version such as 2.0.0. It will work as well as 2.0.3 for the tutorials. – Leonardo Apr 13 '14 at 13:52
  • I think it very troubling as well. Would the older version be on the website? – Jeremy Beare Apr 13 '14 at 13:52
  • I can't find any old versions on their website. That is even more troubling – Jeremy Beare Apr 13 '14 at 13:54
  • I don't see anything, sorry. I do think I have the old 2.0.0 for MinGW. – Leonardo Apr 13 '14 at 13:57
  • That may work. I hope it does. If it doesn't, what else can be done? – Jeremy Beare Apr 13 '14 at 13:59
  • Well there are many things. But, if you want my honest opinion use a wrapper for SDL such as `http://www.pygame.org` – Leonardo Apr 13 '14 at 14:10
  • Would you suggest using a different software? Perhaps Visual Studio? – Jeremy Beare Apr 13 '14 at 14:15
  • 2.0.3 works for my Visual Studio setup, it just depends how determined you are and what your goals are. I would say yes try it so you know what you like. – Leonardo Apr 13 '14 at 14:22
  • My goal is to relearn C++ fully and get back into using it to build 2D Games. I lost that skill a long time ago and I want it back. But I have spent the last 3 days trying to set up a C++ & 2D config and it just won't work. Do you typically use VS? – Jeremy Beare Apr 13 '14 at 14:28
  • I find myself using CodeBlocks most of the time. Visual Studio feels like overkill. I just go with whatever is easiest to get pictures and colors in a window on my screen. – Leonardo Apr 13 '14 at 14:34
  • Problem is with Code Blocks it just won't play with SDL. Did you manage to get it working with VS? – Jeremy Beare Apr 13 '14 at 14:37
  • Yeah it works fine. But did you still get the same error message even after including those directories? It could just be a small thing you need to do. I once spent weeks off and on trying to get Ogre3D to work not realizing the finer details of what I was doing.. – Leonardo Apr 13 '14 at 14:40
  • I did get those same errors with Code Blocks. That's why I just rebooted Visual Studio. Could I ask what needs to be done to get SDL and Visual Studio playing happy families? I can't find a tutorial on the net – Jeremy Beare Apr 13 '14 at 15:03
  • I thought you said you were using lazyfoo. `http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/index.php` – Leonardo Apr 13 '14 at 15:23
  • Didn't notice there was a Visual Studio one :P Anyway I have no got a lot of errors. But they come in these varieties `unresolved external symbol _main referenced in function ___tmainCRTStartup` `unresolved external symbol _SDL_Quit referenced in function _SDL_main` What on earth is this all about? – Jeremy Beare Apr 13 '14 at 15:24
  • I've managed to get by that error but into another. `http://www.cplusplus.com/forum/beginner/89554/`. I need to find a 32-Bit version of the SDL2.dll. Any ideas? – Jeremy Beare Apr 13 '14 at 15:40