0

This is, I think, a complex problem I'm having. I'm just trying to set up a basic SDL project, I'm actually following this tutorial: http://lazyfoo.net/tutorials/SDL/01_hello_SDL/index2.php

Here is the full build log.

||=== Build: Debug in Drekirokr (compiler: GNU GCC Compiler) ===|
||Warning: corrupt .drectve at end of def file|
||error: ld returned 1 exit status|
||=== Build failed: 1 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|

As you can see, it trows me there is an error, but there is nothing as far as I can understand. Of course the ld returned 1 exit status is an error, but I've searched for the line elsewhere, and it always has some other error, like a typo in a class name reference or something, and for them I think things get solved by solving that other error. The other line, corrupt .drective at end of def file, people having this log seem to be able to compile just fine. In my case, I can't. I've tried compiling anything else, and I've successfully compiled a "hello world" that uses only stdio.h for printf.

Here is my code

#include <SDL.h>
#include <stdio.h>

int main( int argc, char* args[] ) {
    return 0;
}

I've added the search directories and the linker options. I just can't figure what's wrong.

Thanks in advance.

  • 1
    What is your build system? To solve this problem, your build system file may be required, be it an IDE project file or a makefile or cmake etc. – iksemyonov Feb 23 '16 at 19:30
  • See: http://stackoverflow.com/questions/23240158/sdl-2-0-linking-error Also, I highly encourage you to do development in an OS which was built for it, namely Linux, where you can install the compiler and SDL with a single command and have no compatibility issues like this one. – iksemyonov Feb 23 '16 at 19:34
  • Yes, that link solved my problem. Didn't read properly the instructions at the tutorial, actual Mingw libraries and headers are in the i686-w64-mingw32 (for 32bit). I really thank you for your help @iksemyonov and the people responding at the linked question. This question is answered! – Orochii Zouveleki Feb 23 '16 at 19:53
  • @iksemyonov SDL works just fine with Visual Studio. But yeah, MinGW and/or Cygwin can be a pain. – user253751 Feb 23 '16 at 19:59

2 Answers2

1

Thanks to @iksemyonov, found the answer here. SDL 2.0: linking error

Problem was that the actual Mingw libraries, headers and binaries are found at the i686-w64-mingw32 folder. Libs for instance are not at lib/x86. Those are for MSVC.

I actually wonder why the Mingw32 download not only includes the MSVC files, but also gets obscured by it (in my opinion, of course).

Thanks everyone!

Community
  • 1
  • 1
  • Glad the suggestion helped. You can accept your own answer to indicate that the solution worked and the problem is now solved. – iksemyonov Feb 23 '16 at 20:51
0

Ok I tried your code, it worked for me. Than I put the code just into one main.cpp file (so no project), and ld returned 1 exit status, too.

So try to put your code into a project file! That should solve it

ParadobC2
  • 72
  • 7