How do I include VL53L0X headers into my STM32L project - c

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

Related

Compiling SDL 2 alongside my own source files

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.

Arduino - Robot Car Kit with NewPing.h library

I downloaded the NewPing.h library and included them in the arduino library folder but I still getting this error:
N:\Arduino\avoi\avoi.ino:3:21: fatal error: NewPing.h: No such file or directory
#include <NewPing.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
Go to the Arduino IDE, in the top go to Sketch -> Include Library -> Manage Libraries...
Then search for NewPing, and install the only one that shows.
After that you're done you can use the header like so:
#include <NewPing.H>
Hope it helps.
To check the correct syntaxis go to Arduino IDE > File > Examples and search for newping examples (they will appear if newping library is installed) if not go to Sketch > Include Library > Manage Libraries > Search for newping > install

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.

How do you configure XCode to find header files and symbols in an "External Build System" project

I'm trying to set up an XCode 5.1 project for C php-extension development. This is essentially a GNU autoconf/automake project with one prerequisite step.
I created a new "External Build System" project. I then made two targets, one that runs the prerequisite "phpize" command that creates GNU autoconf files. I have another target that runs the GNU ./configure script. This all works great.
Next, I tried adding my .c and .h files to the project. When I open them, and try to click on any #include .h file or any external symbol, XCode says "symbol not found", even for system stuff like <stdio.h>.
In a normal XCode project, there is a way to configure the header/include search paths. With this external build system project, I see no way to do this.
My questions:
For a project that uses ./configure and make, is the "External Build System" project type the correct type?
If so, then in this project type, how do I set the header/include search paths so that code navigation works?
Analyze doesn't seem to work right, either.

How to get opencv include work in kubuntu? (Includes solution to how to include and link in netbeans 6.7.1)

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

Resources