Where is the header file of emscripten/bind.h? - c

I am using emcc to compile c++ to wasm on Debian 11.
It is successfully done.
So I think emcc knows the path.
But VS Code shows error squiggle under #include <emscripten/bind.h> because it doesn't know the path to the header file.
Where is the header file?
I'm not familiar to c++ and I install emsdk via git (I just follow the official tutorial here https://emscripten.org/docs/getting_started/downloads.html).

found at ./emsdk/upstream/emscripten/bind.h
https://github.com/emscripten-core/emscripten/blob/main/system/include/emscripten/bind.h

Related

openGL with glew - file missing

I tried getting this repository to work.
And here is the problem: I saw that the demo program included GLEW as a static library (not sure about that - the source code of GLEW is included. Is that a library then? I don't know) and I thought because I'm on Ubuntu (20.04) that could be done easier. So I used the sudo apt-get install libglew-dev to install all needed header files and so on. Easy! But then there came a part in the demo where the header file eglew.h was used and gcc could not find that. I looked into /usr/include/GL and this header file was really missing. I tried installing a bunch of other packages. No success.
Does someone out there know how I get the package with this header file? Or is there no other way around than to do it like in the demo with a CmakeList?
You should be able to find the missing header file from here which is the official site: http://glew.sourceforge.net/
If not, you can defiantly find the missing header here:
https://chromium.googlesource.com/external/github.com/google/quic-trace/+/refs/heads/master/third_party/glew/include/GL

Why linker error when trying to compile SDL?

I am watching a seminar on writing 2D games in C, on YouTube here:
https://www.youtube.com/watch?v=yFLa3ln16w0&t=654s
The instructor says to install the SDL software packages, using apt-get install. I already have these files. I checked, and they are in the C search path, in the directory /usr/include/SDL2. The instructor has a GitHub with example code that demonstrates the basics of SDL. Here is the GitHub repository:
https://github.com/tlively/sdl_seminar
Here is SDL's website:
https://www.libsdl.org/
The problem is, when I try to compile the file hello1_sdl.c (in the GitHub repoistory) using gcc -o hello1_sdl hello1_sdl.c, it gives me an error. I looked up what it meant, and it's a linker error. I don't understand why this is happening, as the header files are in the appropriate place.enter image description here
How do I fix this?
The include files for the C/C++ compilers are only half the story. You also need to tell the linker to use the library! If you have everything set up properly, all you should need to do is add -lSDL2 to your final command line (the one with -o that does the linking.)
See more examples at: Lazy Foo' Productions

Cygwin shadow.h not found

I am trying to compile a program in Cygwin and it requires shadow.h in one of the source files, which is missing in the /usr/include path. How do I add shadow support in Cygwin ? any packages to install ?
In CentOS, just installing gcc and glibc provided the shadow.h header file. what are the equivalent packages that I need to install in Cygwin ?
shadow.h is to define the type struct spwd, and it is a part of Gnulib.Your compilation is not getting support of this lib.
There should be a libshadow.a in /usr/lib and you need to include it during build as follows
gcc program.c -o program -lshadow
for better understanding you can look here also.
Edited Later:
I just got to know there is some issues in porting of shadow.h and this problem covers cygwin too.Please refer here.
There is none currently, so this isn't going to work until someone contributes those APIs to Cygwin.

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.

How do I link libraries in Xcode 4?

I'm a complete beginner to Apple's Xcode, but I have followed the Xcode documentation and the advice of a few related questions without success.
I installed GMP to /usr/local/bin, wrote a short program using the library, and compiled with gcc main.c -lgmp. It compiled with no warnings or errors, and the executable worked flawlessly.
I started a new Xcode project (Command Line Tool; Type: C), copied the code to the newly created main.c, and opened the project build settings. From there I set Linking > Other Linker Flags to -lgmp and Search Paths > Library Search Paths to /usr/local/bin. However, the build fails with the preprocessor error "Gmp.h: No such file or directory".
I have tried almost every header imaginable:
#include "gmp.h"
#include <gmp.h>
#include "gmp"
#include "libgmp.a" . . .
This has been my main obstacle over the last three months which has prevented me from learning C. Any help leading me to an eventual solution would be greatly appreciated.
There's a few things you have to set up in your Xcode project. For example, I have gmp installed in /opt/gmp/5.0.2 and I will use that as an example. The actual library is installed into /opt/gmp/5.0.2/lib and the header files into /opt/gmp/5.0.2/include. When installing the library setting the --PREFIX flag to /opt/gmp/5.0.2 would handle this automatically. If you don't set this flag the prefix is usually set to /usr/local by default.
The Other Linker Flags looks right, it should be the name of the library.
Set the Header Search Path to the include directory, in my case /opt/gmp/5.0.2/include.
Set the Library Search Path to the lib directory, in my case /opt/gmp/5.0.2/lib.
Since the header search path has been set, you should now be able to include the header file like this:
#include <gmp.h>
Of course, replace /opt/gmp/5.0.2 with the PREFIX path you used when you installed gmp.
Lastly, you typically don't install libraries to /usr/local/bin, you would install to /usr/localand let any binaries be installed into bin while libraries like these would be installed into lib. Of course any path scheme would work, I usually recommend /opt/<project-name>/<version-number> since it allows me to keep better track of what I have installed and have multiple versions of the same libraries and tools without having to deal with collisions.
I have updated my system from snow leopard to mountain lion and had to install gmp.
First of all I have installed Xcode CommandLineTools set.
Secondly, installed Homebrew. Then with it I have done steps in this topic: https://apple.stackexchange.com/questions/38222/how-do-i-install-gcc-via-homebrew
In my last step, made changes to an xcode project as colleague Marcus Karlsson told.
It's finally working! Very big Thank You :)

Resources