WebKit header file confusion - c

I've downloaded and installed WebKit (webkitgtk-2.26.1) on my Ubuntu 19.04 computer for use with C/GTK+, and I have an issue with the include files. All of the sample code I'm seeing includes the header files as #include <webkit2/webkit2.h>. But there is no webkit2 folder installed with WebKit, although all the header files in ~/Utils/WebKitGtk/webkitgtk-2.26.1/Source/WebKit/UIProcess/API/gtk/webkit2 refer to
#include <webkit2/*.h> as well. I don't think I want to start editing WebKit header files, so I'm hoping someone out there has run into this and can point me in the right direction.

you can try:
mkdir /usr/local/include/webkit2 or mkdir /usr/include/webkit2, then copy the header files into the directory.
or
configure C_INCLUDE_PATH=$C_INCLUDE_PATH:~/Utils/WebKitGtk/webkitgtk2.26.1/Source/WebKit/UIProcess/API/gtk/
you can refer to https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html

Related

C header files are missing after upgrading OSX to Majove 10.14.4

Header files like stdio.h and string.h should be located in /usr/include but they have been removed after upgrading macOS to the current latest version. (10.14.4)
The compile progress may succeed (built-in clang may find these header files elsewhere) but code completion supported by IDEs cannot work without these header files located in the right place.
The following code:
#include <stdio.h>
May be considered error (header file not found).
Fortunately, I found stdio.h by using locate command and it was located in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/, but this directory is not automatically included in CLion.
I'm not sure creating a symbolic link or just copy all these files to /usr/include can work without bad side effects.
Sorry for my self-answer.
But I think this could be useful to others who accidentally upgrade their macOS to 10.14.4.
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Run this command and you can have all header files installed in the right place.

CMake: Header files cannot be opened

I am working to build a Code Composer Studio project using cmake, which is new to me. It builds successfully under Linux but I am struggling to get it to work under Windows. The cmake command executes without issue, but make fails during the very first C object at the very first #include with the error code
fatal error: could not open source file "stdbool.h" (no directories in search list)
I'm using the libraries included in CCS's compiler (c6000_7.4.15), and that whole folder is included in the CSS project. I include it in cmake as well. In my .cmake file:
set (CCS_ROOT ${CCS_ROOT_V6_WIN} CACHE PATH "code composer install directory")
set(CGT_COMPILER_ROOT ${CCS_ROOT}/tools/compiler/c6000_7.4.15 CACHE INTERNAL "DSP Compiler Root")`
And in the CMakeLists.txt file:
set (COMPILER_INCLUDE ${CGT_COMPILER_ROOT}/include)
INCLUDE_DIRECTORIES ("${COMPILER_INCLUDE}")
Why can the header files not be opened when they're linked in the project and CMake can find them just fine?
EDIT: The directory structure had been changed underneath me, so I took the opportunity to add all of the external files directly into the project to make it completely platform-independent. That way, since the project is managed by our Git repository, users won't have to install the CSL or any other programs to build the project. This also means that paths to libraries and header files will never change between revisions and environments.
Unfortunately, this has not solved my problem. The project continues to build in Linux while failing to ind the very first included header file. I also notice that, under Windows, it cannot find my own header files unless I provide a relative path, e.g. #include "../Common.h" I can get make to find stdbool.h if I provide an absolute path to the compiler directory, but that exposes a web of additional broken links between files.
As a side note, the project builds successfully within Code Composer Studio, so I am assuming that this isn't an issue with my specific Windows environment nor with the code within the project itself.
This seems to be an issue with gcc.exe. I set an environment variable CC to the path of a different compiler (in my case a TI compiler) within my build script and that fixed the problem.

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.

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