Due to a compilation bug I cannot correctly use the SDL dynamically linked, I don't prefer to go with the static linking route as I'm not sure of how well implemented this is in the language I am using.
That's why I would like to compile the SDL 2 source files manually, I simply used the files present under /include and /src in the official repo, but at compile time I get this error:
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/video.c:23:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
^~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/keyboard.c:26:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
^~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/gl.c:23:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
^~~~~~~~~~~~~~~~~
1 error generated.
I know it is possible to do that since the official website mentions it, but I don't know at all what steps I should follow in order to make it work correctly?
EDIT :
Here is the sample repo: https://github.com/adtrevor/compileSDL
SDL is a cross-platform library, and its unlikely that you want to compile all of the source files in order to get the functionality that you need. Usually you run configure / make, and it will make the decisions on what to build/not build.
You mention that you are building the source files yourself; so you may want to obverse the SDL build and try to capture the same files. In regards to your error, QNX is the Blackberry operating system-- so depending on your use-cases you can avoid building everything under SDL/src/video/qnx/* since you don't have those operating system headers anyway.
SDL should build the static libraries by default anyhow. Consider doing a regular build and using sdl-config --static-libs to find out which static libraries you should link with.
Related
I'm building a small C project from source (https://github.com/danos/vyatta-route-broker) which has multiple .c and .h files. I run its Makefile and this error occurred:
"fatal error: ini.h: No such file or directory"
It is due to this line in one of its files:
"#include <ini.h>"
There is also "LIBS += -linih -pthread" in the Makfile. I commented out ini.h library in both places, but it is a necessary one and building is impossible without having it.
What is "ini.h"? It is a C standard library?
How can I find it and install it on my system?
I think inih in your case refers to the library inih (INI Not Invented Here), it is a simple .ini file parser. They have a github page https://github.com/benhoyt/inih. Also, if you are using linux, you can search on the package management tool of your distribution. For example, for debian you can get it from this link https://packages.debian.org/bullseye/libinih-dev.
Language: C
MCU: STM32L151C8T6
IDE: Atollic TRUEstudio
Library: https://www.st.com/content/st_com/en/products/embedded-software/proximity-sensors-software/stsw-img005.html
Problem: "fatal error: vl53l0x_api.h: No such file or directory #include "vl53l0x_api.h"
I have included the library(core & platform folder) that was extracted from "en.STSW-IMG005" into my project, I have checked my [build settings > include directories] and both the folders are there, however it keeps failing to compile.
It always show "fatal error: vl53l0x_api.h" but it jumps from file to file every time I compile eg. "vl53l0x_api_core.c", "vl53l0x_api_calibration.c", etc.
Reason why I must use the library provided by STM is because they did not release the I2C registers for this distance sensor, so I'm forced to use their library. I have tried referencing guides provided for VL53L1X but it didnt quite work.
You need to add the path where the header file is to the project. Right click on the project > properties > build > paths and symbols
I was trying to compile a C exploit for a security class I'm in and was struggling to get GCC to perform. The issue is that my /usr/include folder is missing folders that GCC is looking for to handle the includes of the file. The first error below describes a folder that doesn't exist.
asm/page.h: No such file or directory
What I've tried so far:
Symlink it with my /usr/src/linux-headers-4.4.0-kali1-common/include/* folders, but files within that folder start throwing errors that they in turn can't find other files.
Using GCC's -I parameter to manually specify each folder to look in for my includes but this also doesn't work. (Below)
gcc 10613.c -o workdamnit-I/usr/src/linux-headers-4.4.0-kali1-common/include/asm-generic/ -I/usr/src/linux-headers-4.4.0-kali1-common/include/linux/ -I/usr/src/linux-headers-4.4.0-kali1-common/include/uapi/asm-generic/ -I/usr/src/linux-headers-4.4.0-kali1-common/include/uapi/linux/
ERROR: In file included from /usr/include/stdio.h:33:0,
from 10613.c:2:
/usr/src/linux-headers-4.4.0-kali1-common/include/linux/stddef.h:4:31: fatal error: uapi/linux/stddef.h: No such file or directory
compilation terminated.
I updated the import statement to use page.h from my kali linux common headers. When I tried to run this, I received the below error:
'PAGE_SIZE' undeclared (first use in this function).
Lastly, I tried to compile with wine gcc but this particular exploit uses a socket library that I guess can't be compiled on a windows machine.
GCC version: 5.3.1
Link to exploit: https://www.exploit-db.com/exploits/10613/
My knowledge of C and its compilation requirements is very limited. Any assistance would be greatly appreciated.
Please give a usable and compilable example: https://stackoverflow.com/help/mcve
Based on the errors, it looks like -I/usr/src/linux-headers-4.4.0-kali1-common/include/uapi/linux/ should actually probably be -I/usr/src/linux-headers-4.4.0-kali1-common/include.
I'm trying to statically link glib into my C program. I'm not sure what's the best way to do this. I downloaded the code and put it in a subdirectory called glib-2.36.4. I added "-Iglib-2.36.4" when using gcc. The glib.h is in the glib-2.36.4/glib directory and in that file there are references to other header files under the glib directory (such as #include ).
I'm not sure why that is since both glib.h and these other header files are at the same level (in glib subdirectory). I got a compile error due to galloca.h not being found (even though it's there). So I copied glib.h up one level and those errors went away. I then got an error about a missing glibconfig.h. I copied that from my usr directory and that error went away. I compiled my project and now I'm getting an error about undefined reference to g_ptr_array_new. I guess this must be because I haven't actually compiled glib. I had tried to build glib, but when I typed "./configure", but I got this message:
checking if arpa/nameser_compat.h is needed... configure: error: could not compile test program either way
I did install glib using yum, but I really want this code to run even if glib is not installed on a machine.
You need to install both glib and glib-dev via yum, compile using ./configure, (take a look in the ./configure script to see if there are any flags you need to supply or defines you need to produce the static build), without moving any files about, and then you need to compile your code using -i path/to/glib/includes and link with -L path/to/built/static/library
I have installed OpenCV C libraries from package management into my Kubuntu 9.10. I wrote a small image modification program that uses those libraries, but I can't compile it, because every time I try to compile I get the error message that the functions from OpenCV library cannot be found.
Those header files are in folder /usr/include/opencv/ but still the compiler says that functions cannot be found.
I have tried to include them by basic
#include <highgui.h>
#include <cv.h>
commands in netbeans (and I have set netbeans to search header files from that specific directory) and also tried to include them with full path.
#include </usr/include/opencv/highgui.h>
#include </usr/include/opencv/cv.h>
Also I tried to compile my source file in console (with full path includes), but again I got the same error message that the functions from those libraries cannot be found.
Edit:
The error message that I get is
undefined reference to 'function_name'
I get that error for every function that I try to use from that opencv library.
Any idea how to fix that problem?
Edit II:
in case someone else is using netbeans 6.7.1 and has the same problem, here's the solution copy pasted from another website:
Here I presume that you have succesfully installed the opencv library either manually or via package management.
Open Netbeans then do the following:
Select Tools -> Options -> C/C++ -> Code Assistance -> add Include Directories
(For me, /usr/local/include/opencv)
Create new project, then:
Right click on Project Name -> Properties ->Build -> C/C++ Compiler -> Include Directories
Include Directories : /usr/local/include/opencv
Right click on Project Name -> Properties -> Build -> linker ->
Include Directories : /usr/local/include/opencv
Additional Options : -I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml
Then writing program and compile!!
"undefined reference to" is a linker error. You forgot to link your application against the OpenCV libraries. Make sure you link against cv and highgui (-lcv -lhighgui) or use the pkg-config call that Tobu provided. I'd also second the request for more detailed error messages.
OpenCV uses pkg-config, the standard way to locate libraries and headers on unix. You can run (untested):
make CFLAGS="$(pkg-config --cflags --libs opencv)" your-program