Hello Stack overflow Community,
I'm developing an C application for a Imx6 development kit from Variscite with yocto project and Eclipse Kepler. I've build an helloworld application according to the guide and written some additional code, which I now want to place in different source and include files to keep things neat and tidy. I've made the following files: uart.c, uart.h, gmttime.c and gmttime.h and included them in the src folder. Now my problem is that when i call any function from any source file that I created, I get the following compilation errors:
Description: Resource
make: *** [all] Error 2 Helloworld C/C++ Problem
make[1]: *** [all-recursive] Error 1 Helloworld C/C++ Problem
make[2]: *** [Helloworld] Error 1 Helloworld C/C++ Problem
undefined reference to `uartInit' Helloworld.c /Helloworld/src
My project files look like this:
Helloworld
/includes
/usr/include
/usr/include/x86_64-linux-gnu
/usr/lib/gcc/x86_64-linux-gnu/4.6/include
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
/usr/local/include
/Helloworld/src
/src
gmttime.c
gmttime.h
helloworld.c
uart.c
uart.h
makefile
makefile.am
makefile.in
#more files are in this project, which I think are not so interresting or cause or solution to this problem.
On different websites it's mentioned that I should add the directory to the project options under:Project->Properties->C/C++ General/Paths and Symbols to the Includes and Source Location Tabs. I've added /Helloworld/src and /helloworld to both tabs, but I'm still getting errors no matter what i try. I can't find any other solution to this problem, so I hope anyone has encountered the same problem and could tell me how to resolve it.
I'd be most gratefull if anyone could help me out, if anything is wrong with my question or more information is required, just ask.
Regards,
Edit:
uart_init's function prototype is declared in uart.h and the function excists in uart.c, both files are user made, so no library inclusions are required.
I have uart.h included in my helloworld.c file, just as i would include it in any normal c application. The code highlighting does not show any errors at #include "uart.h", although it shows a red underline at each function from uart.h, complaining; undefined reference when i hover my mouse over the function.
I can open a function declaration and then eclipse takes me to uart.c and shows the function's source code. It seems that the compiler does not include additional .c and .h files except those originally made by the Hello World ANSI C project in it's build, eventhough it refers correctly when i use F3 "Open decleration" on a function. I don't know if the make file automaticly includes the new files in a build or my project source location set under Project->Properties->C/C++ General/Paths and Symbols is incorrect.
The solution was quite simple, I had to include uart.c to the project_SOURCES in the makefile.am. I've been searching in the wrong direction all along, as I thought the problem was caused by a wrong or unset project configuration. The solutions I found on the web were all resolved by setting the Includes and source location folders under C/C++ General settings and thus I thought the solution was in the project configurations. With a little bit of trial and error I finally found the solution.
Related
Okay so I have been working on this fork for over a year now and this thing doesn't want to compile as dll on x86-64 mingw running on Windows 10. I am following the original instructions: https://github.com/kometbomb/klystron/wiki/libksnd#compiling-the-library
And this is what it tells (there are other errors which can be fixed but this infuriates me the most):
Building ksndstatic.lib...
make: lib: No such file or directory
make: [Makefile:117: bin.release/libksndstatic.a] Error 127 (ignored)
Linking ksnd.dll...
Building ksnd.lib...
make: lib: No such file or directory
make: [Makefile:127: bin.release/ksnd.dll] Error 127 (ignored)
What the hell is lib?! Is this Visual Studio thing or outdated name for dlltool or libtool? What kind of zombie toolchain is this even made for? (hint: year 2007 or even earlier)
This can be relatively easy compiled as a submodule using the same windows mingw toolchain: https://github.com/kometbomb/klystrack
Or, if this does not work, try my fork: https://github.com/ltva1/klystrack
So the question is how to compile it at least with SDL linkage? Maybe I will be able to get it to work with native OSes APIs but at least I want a dll I can use in other C/C++ project.
Okay, the static linking works at least. There are some problems with audio buffer but this is outside of this question scope. I followed the advices in the thread above: undefined COMSPEC and added linkage to winmm in the case COMSPEC is not defined. See makefile changes there: https://github.com/LTVA1/klystron/commit/47e4c31c86833ce8d879d4474ba4045e95ea1a22 (COMSPEC undefine thing is commented out so main project which uses the repo as submodule gets compiled; -lwsock32 thing is unneded actually). At least I get the sound from the thing. Will wait 2 days to accept as answer.
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.
I am newbee c programmer so be patient. I have a MSP430 C project in Code Composer Studio 7.3 using windows 7. My project (USB) was working fine and then I tried to add more code to incorporate a SPI interface and everything went sideways. I restored my original code but now have problems that weren't there before. Seems to compile but has several unresolved symbols errors in the linker (I think). I have searched/researched many answers to these types of problems on the forum and tried many things (over the past two days!!) and cannot resolve my problem. Possibly I made things worse by copying library/functions directly into my project directory but still didn't seem to change anything. The errors are related to standard MSP430 functions, not my code. My project tree looks like:
project tree
Errors from Console are:
console errors
From everything I have read it indicates that either I have a compiler library path problem or a linker file path problem. Tried a lot of combinations to no avail. Following are the compiler and linker path info:
linker 1
linker 2
If I look in my repository of library stuff downloaded from TI you can see that the dma.h and dma.c files which reference the error message lines in the files are there and I don't understand why the linker can't do its thing.
dma file tree
In the linker under library files I noticed the original libmath.a file didn't point to anything so I found one and added it (not help). Also the libc.a points to a section of 3 directories (different versions of a tool) which each have a different version of libc.a and I think I tried all of them. See below for directories
directories
Any help would be greatly appreciated
A CLUE POSSIBLY: CLUE? In my quest to solve my issues, I created a new CCs project and pasted my main.c file in and then went through a series of compiles solving the errors as the showed up. I was down to one error : can't open source file hal.h. I believe this is a file that was included with the usb example code I started with. After copying it into my project I am back to square on with all the errors listed above. To get here I only needed to point the compiler to driverlib to solve previous errors. The hal.h file seems to only include driverlib.h which is also referenced in my main function so why all the errors??
FIXED BUT WHY!!!
To solve this issue I imported the drivlib directory from the TI repo on my D drive into my project. Now everything compiles. Can anyone tell me why I had to do that given that I had path directives to look on my D drive?? Can it be related to search path length being too long?
During the development of a small project using statically linked OpenSSL 1.0.2e I encountered a strange error in VS13:
Error LNK2001: unresolved external symbol _BN_is_zero
Quite often, this happens when you forget to properly liked .lib file in the project properties, but all of the properties were double-checked - they are correct.
Configuration - Release, MT, libs are MT, bh.h included.
And even if one of the libraries is not linked properly, I should have multiple compiler errors complaining about unresolved external symbols of all the elements used in the project, but in my case unresolved external symbol is the only BN_is_zero.
After quick googling there wasn't found any issues, related to openssl bugs and I guess that the problem resides at my project.
Any tips will be appreciated.
UPD
Here is some screens:
I actually forked the csrp github project and compiled it against the particular openssl libraries you are pointing at. I had to slightly modify test_srp.c and src.c to add some code that isn't available on VS2013. A fork of csrp with the changes applied and the visual studio project for VS2013 to compile it can be found here:
https://github.com/sigmoidal/csrp
Note that you need to change the paths of the openssl path on BOTH the debug and release versions to reflect your VS Configuration Properties:
C/C++ > General > Additional Include Directories
D:\dev\openssl\openssl-1.0.2e-vs2013\include
(you should not point it to $openssl_path/include/openssl, it will not work)
and also:
Linker > Input > Additional Dependencies:
For release configuration:
D:\dev\openssl\openssl-1.0.2e-vs2013\lib\libeay32MT.lib
D:\dev\openssl\openssl-1.0.2e-vs2013\lib\ssleay32MT.lib
For debug configuration:
D:\dev\openssl\openssl-1.0.2e-vs2013\lib\libeay32MTd.lib
D:\dev\openssl\openssl-1.0.2e-vs2013\lib\ssleay32MTd.lib
(notice the "d" suffix on debug libs)
Compiled ok for me.
I'm guessing here, but according to the OpenSSL source BN_is_zero is defined as a macro:
http://osxr.org/openssl/source/crypto/bn/bn.h#0407
So perhaps the module that is compiled into srp.obj is making a call to BN_is_zero but is not including bn/bn.h and in the absence of a prototype the compiler is generating a default one.
If this is the case, including the bn.h definitions should avoid the linker error.
It was tricky, but I've finally solved it based on the Drew MacInnis tips.
The matter is that openssl 1.0.2e broke the BN_is_zero functionality by simply removing the macros-containing header from sources. So, the solution is:
Download the bn.h include file from 1.0.1h (or here)
Place bn.h to %OPENSSL_HOME%/crypto/bn directory
Change #include <openssl/bn.h> for #include <../crypto/bn/bn.h>
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.