use of undeclared identifier error in libraries - stm32

I have made a project in Keil for the stm32f4 discovery board.
I have added all the necessary libraries and when I compile my project, I do get the error "use of undeclared identifier" in some parts of the codes. But when I go to the definition of the identifier, I can see that it has been defined before in the libraries.
I cannot understand what the problem is. I'd be grateful if anyone can help me.

Related

CMSIS and HAL at one project integrating CMSIS and HAL

I am wondering, is it possible to add CMSIS and HAL libraries at the same project in KEIL...
based on my knowledge I added CMSIS libraries in different folder but in compiling I got these errors...
Do you guys have faced with this problem?
Can you help me?
note: the main project was written in CMSIS and I don't want to rewrite it in Hal.
There are 2 files:1-stm32f4xx_hal.h,2-stm32f4xx.h
The first one is defined and used in HAL and the second one is for CMSIS, how can I use both of them in one project?
THIS IS THE ERROR:" #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)" "
and in below is the screenshot.
THANKS.
The STM32 HAL always depends on CMSIS. You cannot use the HAL library without CMSIS.
The error message you have received clearly explains what you have done wrong and what you need to do to fix it. I cannot explain it any more clearly than that.
#error Please select first the target STM32F4xx device used in your application
You might also appreciate to read the comment immediately before the line you have highlighted:
/* Tip: To avoid modifying this file each time you need to switch between these
devices, you can define the device in your toolchain compiler preprocessor.
*/

GCDAsyncSocket in Swift with compile error

I want to use GCDAsyncSocket in Swift, but get the "unresolved identifier 'GCDAsyncSocket'" compiler error. I have imported GCDAsyncSocket.framework but I can't get rid of this error.
I'm sure you've added the framework to your bridging header. But have you checked to make sure the framework is added to the same targets as the Swift file you're trying to use it in?
I typically see this type of compiler error when I have a dependency in my Swift file that doesn't have matching targets. Pretty much the compiler can't think of a better way to tell you this.

Cause for Undefined symbols for architecture i386?

what is the true reason for the "Undefined symbols for architecture i386:" errors that occur?
It appears way too often with various libraries...
Regards
Mirza
Sometimes you need to link with frameworks that are included in the iOS sdk (QuartzCore or CoreData for example). When you're trying to use a class or object of that framework, and you haven't linked it, you're getting the undefined symbols error.

invalid conversion from int to UIBarStyle, objective-c++

I am trying to integrate a popular iphone module(ShareKit).
The module builds and works fine in the provided sample project.
I've added the appropriate files to my project and it won't compile.
I suspect it's due to some project settings of my project.
most of errors are
Invalid conversion from 'int' to 'UIBarStyle'
Cannot convert 'UIInterfaceOrientation' to 'UIDeviceOrientation' in assignment
Invalid conversion from 'void*' to 'UIAccessibilityTraits*'
I've googled and it seems no similar errors were reported related to Sharekit.
Any guess on what setting is messing up the conversion?
I'm mixxing c++ / object-c in my project.
I guess it's because c++ is more strict on type checking than pure objective-c.
just type-casted them all.

Using arduino Ethernet.h under Eclipse

I want to use eclipse for Arduino development and I have some issues.
I use Eclipse + Eclipse AVR plugin + WinAVR. I managed to compile the Arduino core library into a static library.
Now I want to use my ethernet shield but I can't find a way to use the ethernet library with Eclipse.
Copied the folder from arduino-022/libraries/Ethernet and arduino-022/libraries/SPI to my project folder and then I made some changes to the includes in order to work. The result is some errors about DDRB and PORTB.
Added the folders Ethernet and SPI into the project's include path. The result is the following.
main.cpp:(.text+0x8): undefined reference to `Server::Server(unsigned int)'
./main.o: In function `loop':
main.cpp:(.text+0x36): undefined reference to `Server::available()'
main.cpp:(.text+0x3c): undefined reference to `Client::operator bool()'
main.cpp:(.text+0x56): undefined reference to `Client::available()'
main.cpp:(.text+0x64): undefined reference to `Client::read()'
main.cpp:(.text+0xf6): undefined reference to `Client::connected()'
main.cpp:(.text+0x110): undefined reference to `Client::stop()'
./main.o: In function `setup':
main.cpp:(.text+0x138): undefined reference to `Ethernet'
main.cpp:(.text+0x13a): undefined reference to `Ethernet'
main.cpp:(.text+0x144): undefined reference to `EthernetClass::begin(unsigned char*, unsigned char*)'
main.cpp:(.text+0x14c): undefined reference to `Server::begin()'
I don't know what else to do. Has anyone tried something like this?
I have lost all day trying to figure this out and it turns out its actually not that difficult. The lost time is due a bit to the fact that some settings are "invisible" to the make file. Also the generated eclipse makefiles are quite cryptic for anybody without delving into the manual. If you want to take a look at the manual.To the solution itself:
Short version:
Make a static library project of the Arduino Core library and build it.
Make separate static library project for SPI, w5100 and Ethernet
There are some connections which must be made for the projects to build. First I set the include directories to point correctly, which i will describe next. Second i set the project references correct so its possible to build the application with all the right dependent builds.
SPI -> includes the arduino core
w5100 -> includes arduino core and SPI
Ethernet -> includes arduino core SPI and w5100
The Application itself -> include just w5100 and Ethernet (assuming its just the Ethernet - library)
The Application itself -> add the all paths of your projects to the library paths and the respective libraries(without the lib prefix)
Be careful with project renames as they don't propagate through the library settings and paths. Be mindful also of some sanity in your setup so as to make it easier to catch any detail that is missing and breaking.
I will try to edit later with a more detailed explanation but this should answer your question
EDIT
I have tried to just import the Ethernet folder and make a static project out of if. For some weird reason(i don't know the details of Eclipse) Eclipse doesn't go deeper into the utility folder effectively not compiling it. If it does not compile and, as you dont have a static library for that include files you will get undefined references trying to compile Ethernet. Also static libraries cannot be linked through the avr eclipse plugin, and that should actually be enough. There is no such dialog.
Also in a weird error, which i cannot explain and which drove me almost nuts, some magic in the make file invoked the compiler through the cc variable which Eclipse did not define. The problem was solved passing the variable as an argument to make like make.exe CC=avr-g++.
I tried harder to make it work through only one project and it just ended up giving me undefined references to arduino core in the static library build which got me completely petrified.
I know this is not part of the answer to your question but it shall stay here for anybody to find guidance in the process of making Eclipse a de facto Arduino IDE, which is what you ask.
I don't understand how you got the errors regarding PORTB and DDRB but i think it was probably something missing in the build. As in my case it just spat non sense error reports.
The lesson is: Make the separate libraries into static library projects and reference and include them in source and in static library in your final application.
(Side note: Arduino IDE should be completely banned and migrated to Eclipse or some real IDE)