SDL and cygwin and sublime text C language - c

I am trying to use SDL with C language sublime text and cygwin
Basically i downloaded the SDL devel mingw32 tar thing and unzipped it
then i copied the includes to cygwin/usr/include as well as the lib from the unzipped file to cygwin lib
also i moved the SDL.dll to the directory where my file written in c is and i included it with #include "SDL.h"
when i tried to compile it i get this error
$ gcc -o sdl sdl.c
sdl.c:1:17: fatal error: SDL.h: No such file or directory
#include <SDL.h>
^
compilation terminated.
also this is the file i am trying to compile
#include "SDL.h"
#include <stdio.h>
int main(int argc, char *argv[]){
}
can anyone help me out with employing SDL in my programs? i dont know how to make it work and what is missing

The #include "SDL.h" line is making the compiler look for a header file called SDL.h. The SDL.dll file you've copied contains the SDL library's compiled code, but only a little bit of the information you need to interface with it. The rest of that information is in the SDL.h header file, which should be in a folder called include in the SDL-devel-*-mingw32.tar archive you downloaded.
You will also have to link your program to the SDL.dll file by adding -lSDL as an argument when you call gcc. I'm not entirely sure if gcc allows you to link directly to a DLL file, so you may also need the libSDL.dll.a file from the lib folder in the archive.
By the way, Sublime Text is just a text editor and should have little to no effect on how your code compiles.
Good luck!

okay i have found the solution
you need to actually build the file for cygwin by downloading the source file and make & make install
here is the guide
http://www.noquarterarcade.com/using-cygwin-for-sdl-development

Related

Git Bash "fatal error: stdio.h: No such file or directory"

I just finished installing GCC on my windows laptop with MinGW, stdio.h library is there somewhere inside the file but Git Bash and windows CMD do not recognize it. I tried to run a simple Hello World program and it compiles but cannot find stdio.h lib. Can you please help? Thanks
PS. I've tried #include<stdio.h> and #include <stdio.h> (space or no space after include seems to not make a difference).info img
Use the newer MinGW-w64. There is a standalone build available on http://winlibs.com/ and there are some instructions on that site on how to use, including from the Command Prompt.

Linking libraries with a MinGW project in VS code

I am using MinGW version 4.5.2 on windows 10. I am trying to link multiple libraries to a project in VS code. When I try run this command: g++ main.c -o main.exe -I"C:\\Users\\USER\\Programming\\OPenGL Library\\glfw\\include\\glfw3.h" -L"C:\\Users\\USER\\Programming\\OpenGL Library\\glfw\\lib-mingw-w64\\". I get a compile error: main.c:2:24: fatal error: GLFW\glfw3.h: No such file or directory What is wrong with the command above that gives this linking error. As far as I can tell I have pointed MinGW to the library and specified the header file. I am not sure what else I need to add to the command for link the GLFW library as well as other libraries such as GLEW or glm.
If your include directive looks like
#include <GLFW/glfw3.h>
you need to supply a path to a directory which itself contains a directory named GLFW.

MinGW_w64 missing dll's

I am trying to run a C compiler with Cython in a 64-bit Windows 7 platform.
After having various problems with the C compilers from Visual studio and MinGW32, I tried to install MinGW_w64. I did the following steps :
-I downloaded and extracted winbuilds from http://mingw-w64.org/doku.php/download/win-builds, and I selected the Base GCC package with C support.
-I added C:\PATH_TO_WINBUILDS and C:\PATH_TO_WINBUILDS\bin in the PATH Windows environment variable.
-I wrote helloworld.c, a very simple C program :
#include<stdio.h>
main()
{
printf("Hello World");
}
-Then in cmd I wrote:
gcc helloworld.c -o helloworld.exe
And a dialog box pops out with the following error message :
Impossible to start program because libiconv.dll is missing on your computer. Reinstall program to correct problem.
The dll file does not appear in the lib folder of MinGW_w64. I tried to copy libiconv.a and libiconv.dll.a from the MinGW32 lib folder to the lib folder of MinGW_64, but still no luck.
Any ideas?
You need the DLL file, not the .a link library files. libiconv.dll should exist somewhere in the bin directory. If it is not there, you’ll need to get it from the internet or compile it yourself. Alternatively you could just link statically to the iconv library.
Once you find the DLL, make sure it is in one of the following locations:
* the %PATH%
* the appropriate C:\Windows\system32 or C:\Windows\SysWOW64 directory
* (preferably) next to your executable
I was able to fix the problem by downloading another version on the package on SourceForge.
Thanks!

Libdvbcsa, missing header files

I have a problem i cannot solve.
Library repository
I am trying to run test .c files in this library, I have installed the files however when I run this on mac:
gcc testbitslice.c
I get this error
fatal error: dvbcsa_pv.h: No such file or directory
#include "dvbcsa_pv.h"
the testbitslice.c file calls the header files as follows
#include <dvbcsa/dvbcsa.h>
#include "dvbcsa_pv.h"
When I checked urs/local/include there are one file under dvbcsa folder which is dvbcsa.h. But there is no file called dvbcsa_pv.h. I don't understand the problem. I don't get error while installing with ./bootstrap or ./configure and make, make install commands.
Then, I manually copy/paste header files from package folder to usr/local/include, this time it gives error as
Undefined symbols for architecture x86_64
Is the problem related to installation or something else? I would appreciate if you could help me
I have found out the problem. I just had to show the library directory i want to use using:
-I/Users/bill/Desktop/libdvbcsa-master/src/dvbcsa
and it works.

assert.h missing when compiling with mingw

I am compiling C code with MinGW. The C code is a tcl package/extension.
(using the MinGW compilor, downloaded: mingw-get-inst-20111118.exe)
Compiling the code (e.g. the tcl package) works fine under linux.
I am running "./configure" and using the supplied "Makefile.in".
The problem is that the C code at some point includes "assert.h".
The other header files are fine, e.g. for "string.h" and "stdlib.h".
This is because the TCL sources include a subfolder called "./compat". In this filder the header files are located just in case they are not found somewhere else.
But in the "./compat" folder the file "assert.h" is missing. So I get an error.
I searched for the header file in "c:\MinGW\include" but I did not find "assert.h" there.
Either I copy my own "assert.h" in the "./compat" folder. Or I install some MinGW package that puts some "assert.h" in a subfolder of "c:\MinGW\".
=== SOLUTION: ====
c:\MinGW\include\assert.h
I was the hole time in front of me!!!
My bad! thx.
<assert.h> is part of standard C and included with the base dev package:
Did you download the dev package?
Did you download this?
http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.20/
I don't know about the peculiarities of the tcl package, but if it includes its own assert.h. then you should include on on the Include path, along with the libraries that came with it.
Which IDE are your using?
It seems you downloaded only mingw partially. Download the full development package that is bundled with IDEs like Codelite and Code::Blocks.

Resources