error:that the header files are not present in the library files of STM32f0 standard peripheral driver files - embedded

I installed the STM32F0 stand_perip driver library and I wanted to add the driver files to my project on keil software. I did include the header and C files of the STM32F0 stand_perip driver library but this error popped that many header files are not present. like these:
#include "stm32f0xx_gpio.h"
#include "stm32f0xx_rcc.h"
Any leads will help?

Related

Make(compiler) complains about missing llvm/PassAnalysisSupport.h file

I downloaded LLVM (12.0.1) from the script file llvm.sh which they have now started to include on their Debian downloads page.
Ran clang and everything was working as expected(good job dev team I guess?).
The installation script installed LLVM in /usr/lib/LLVM-12/ and /usr/include/LLVM-12/ (these had some .h files)
So I tried writing some passes; created an out-of-tree build using the answer given here:
Facing issue with makefile for Hello pass in llvm
But when I ran the make, it gave me this error:
/usr/include/llvm-12/llvm/Pass.h:337:10: fatal error: llvm/PassAnalysisSupport.h: No file or directory
337 | #include "llvm/PassAnalysisSupport.h"
|
compilation terminated.
So I checked /usr/include/llvm-12/llvm/ and found that Pass.h and PassAnalysisSupport.h both were present in the current directory, so shouldn't the Pass.h file have #include "PassAnalysisSupport.h" instead of the present #include "llvm/PassAnalysisSupport.h"?
I also checked the code for Pass.h online and it also had #include "llvm/PassAnalysisSupport.h". Other header files in the llvm directory also used the same format #include "llvm/<name>"
So what is going on here, who messed up, the devs or my llvm.sh (also the devs) or the problem is something else?
Any help would be appreciated (Im using Mint MATE 20.2 if thats relevant)
Source file (headers; firstpass/first/fpass.cpp):
#include <llvm-12/llvm/Pass.h>
#include <llvm-12/llvm/IR/Function.h>
#include <llvm-12/llvm/Support/raw_ostream.h>
#include <llvm-12/llvm/IR/LegacyPassManager.h>
#include <llvm-12/llvm/Transforms/IPO/PassManagerBuilder.h>
(firstpass/CMakeLists.txt):
find_package(LLVM REQUIRED CONFIG)
include_directories($(LLVM_INCLUDE_DIRS))
add_subdirectory(first)
(firstpass/first/CMakeLists.txt):
add_library(LLVMfirst MODULE fpass.cpp)

build new project include dll and compiler to so

I am a question about dll use in linux. I have dll and .h file that work good in windows. But now I need to work this program in linux. If I write a .cpp file that
function call the dll file's function. Could I compiler this .cpp file to assembly or to .so file. Then I can use .so file without original dll file ?
If you have a DLL that builds on Windows, then provided the C++ code is portable, it should be possible to compile the same code on Linux to produce a shared library (.so file), which is Linux's equivalent to Windows DLLs. There is good background on this topic here.
If your source code (i.e. CPP or header files) uses #include for headers that are Windows-specific, you will have to make that code portable in order for Linux to build and run it. One approach is to just try compiling your code on Linux and see what errors arise. If you want to be more proactive, for C++ portability guidelines see here.

c++ static library import to XCode Cocoa project

I'm very new at Objective-C programming, I have a MacOSX project, with a simple UI code. It has a login function.
I have a .a extension c++11 static library, with two public headers. One includes . I d like to import the library with the headers to my project. It makes the login to my server.
I made a c++ static library target to the code, and imported the needed files, set the c++ flags (stdlib=libstdc++ and -std=c++11) and added gcc49 to search paths. But I get file not found exception to #include in my c++ header.
Have somebody a good tutorial how to solve my problem?

How to add a static library CppUTests to my project atmel studio

I'm using Atmel Studio 6.1.2 SP2. I'm setting up CppUTest for our embedded system project.
I created a static CPP library for the CppUTest Framework which copiled successfuly after a small change. Now I'm including this library to a test project. A C++ application project.
The issue I'm facing now is that even though the intellisense is auto completing my include, that means that it sees where the library is, I get "No chuch file or directory" error when compiling.
In GccApplication1.cpp I have this:
#include <avr32/io.h>
#include <CommandLineTestRunner.h>
int main(int ac, const char** av)
{
/* These checks are here to make sure assertions outside test runs don't crash */
CHECK(true);
LONGS_EQUAL(1, 1);
return CommandLineTestRunner::RunAllTests(ac, av);
}
And the error is that it can't find the CommandLineTestRunner.h. I tried with "" and <> but it doesn't see it.
Any ideas?
For more information. I'm following the steps from Atmel, here is the tutorial:
Adding the library only tells the linker that the file is available to be linked with the rest of your object code. What appears to be missing is telling the compiler where it can find the header files for the library. If you add the library path to your include list you should be good to go.
The "No such file or directory" error is a preprocessor error. It is telling you that the include file cannot be found in the include file path. Your IDE will have a way to specify the include path.
If you are using make, then you will want to use the -I option.
If you are using CppUTest's MakeFileWorker.mk, you will want to add define an environment variable, CPPUTEST_HOME, that specifies the directory where you installed CppUTest.
I hope that helps.

Plugin with own library kills Browser

I am new to C++ and plugin development. I am working with/for Unix and for the Firefox browser. So here we go:
I have a plugin which uses some classes from a own library. The problem is: it kills my browser asap. I cant even start my browser as soon as MyPlugin.so is in the plugin folder of the Firefox. The library is build and doesn't kill a desktop application that uses it.
My guess is that I failed at linking my library with CMake or forgot to include some stuff from FireBreath. So here are the two things I assume are wrong, maybe someone can help me out.
1) (wrong?) linking with Cmake:
I added some of these at the end of the CMakeLists.txt of my project. The paths are where the library is.
add_definitions(-L${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/bin)
add_definitions(-I${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/src)
add_definitions(-lcoala64) [name of the library]
add_definitions(-Wl,-rpath=${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/bin)
add_definitions(-pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/harfbuzz -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0)
And used the prepmake.sh to generate my build files. Then I followed up with adding flags manually (because I dont know a better solution) to the in the /buid/projects/MyPlugin/CMakeFiles/MyPlugin.dir/link.txt
-L/home/username/swp/dev/lib/bin
-I/home/username/swp/dev/lib/src
-lcoala64 -Wl,-rpath=/home/username/swp/dev/lib/bin
Afterwards I could build the plugin. It builds, so one could assume I have linked correctly. But said crashes appear as soon as I want to use it.
2) Do I use the library wrong?
I include like this in MyPluginAPI.h:
#include <string>
#include <sstream>
#include <boost/weak_ptr.hpp>
#include <boost/smart_ptr.hpp>
#include "JSAPIAuto.h"
#include "BrowserHost.h"
#include "X11/X11KryptoKoala.h"
//Include from my own library:
#include "../../../lib/src/Key.hpp"
As soon as I add the following line to MyPlugin.cpp I get the mentioned crashes while the same line works without a problem in the desktop application that uses the same library:
Key key(password_);
Now I hope this isn't a too big wall of text and someone is willing to investigate and answer to me.
You shouldn't use add_definitions() in that way. CMake allows to differentiate your directives in different categories, so that they only go in the necessary command line. You should use:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
include_directories(/usr/include/gtk-2.0
/usr/include/cairo
etc. etc.
)
add_library(the_name_of_your_target gtk-x11-2.0 gdk-x11-2.0 ETC. ETC.)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/bin)
Furthermore, there are FindPackage functionalities that can help you setting automatically variables containing the name of your libraries, their directories, their include path.
Most information can be found here and here
Then: What is then prepmake.sh? Are you running cmake at all? Can you use cmake-gui, and then select one canonical build system, like make or ninja?
Finally: It could be that you have a crash because your library are not in your library path. I assume you are under linux, here are some ideas: LD_LIBRARY_PATH vs LIBRARY_PATH and LD_LIBRARY_PATH