Undefined referece to Function for OpenSSl app in Eclipse - eclipse

Hi am new to eclipse IDE and OpenSSL . It shows the error called cannot open lib files and Undefined referece to (Function). Can anybody give me suggestion for adding the correct path for the application am trying from last few days am stuck with it.......
the error look like this Build Error
Build of configuration Debug for project R&D **
Internal Builder is used for build **
gcc -LD:\source codes\openssl\lib -oR&D.exe openssl\applink.o main.o
main.o: In function main':
D:\c&c++programs\R&D\Debug/../main.c:53: undefined reference toRAND_pseudo_bytes'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 331 ms.
one more thing am using the MinGW as my compiler for Eclipse.It is a C & C++ application

... am new to eclipse IDE and OpenSSL...
You must add OpenSSL to the project.
First, OpenSSL includes must be added:
Second, the OpenSSL libraries must be added:

Related

How to fix Xcode linker command ld emulation error message issue?

So in the process of trying to find a way to offset my c program in the linking phase to 0x1000 for the standard kernel loading spot, I downloaded binutils from GNU (myself, not through Homebrew), which seems to have created a tricky error. When I invoke ld in Terminal, I get this error message(yes the blanks are what's displayed):
ld: unrecognised emulation mode:
Supported emulations:
Even after going through each directory in binutils and make uninstalling each, and removing and then redownloading Xcode CommandLineTools, the issue persists. I'm a bit lost- any ideas? Thank you!
Forgot to mention, I noticed ld wasn't included in the initial download of binutils, and downloaded it seperately through the ld directory of binutils. This was before I saw that GNU doesn't support Darwin for ld unless its installed as a cross-linker, yet it still ended up on my system somehow (I didn't install it as a corss-linker). I uninstalled ld along with all the other binutil functions.

Showing: collect2.exe: error: ld returned 1 exit status - on building C program

I'm fairly new to programming. These are the files I downloaded for a C project that I have to do. They work fine for everyone but I am unable to move forward because of the error that VSCode is throwing.
Link to repo: Project1 Movie Table
The error:
> Executing task: C/C++: gcc.exe build active file <
Starting build...
C:/MinGW/bin/gcc.exe -fdiagnostics-color=always -g C:\Users\sanyu\Desktop\CS354\Project1\student_functions.c -o C:\Users\sanyu\Desktop\CS354\Project1\student_functions.exe
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain#16'
collect2.exe: error: ld returned 1 exit status
Build finished with error(s).
Terminal will be reused by tasks, press any key to close it.
I looked at similar problems faced by others but I could not figure out how to solve my issue.

How do I develop bare-metal i.mx6sx code using eclipse?

I was wondering if you could help me with some issues and questions I have for developing for the i.MX6 SoloX in bare-metal. I was looking at this link https://community.nxp.com/docs/DOC-106253 and downloaded the files there to use as an example of how to develop bare-metal c code for the i.MX6.
Then I setup my eclipse environment according to this tutorial https://community.nxp.com/docs/DOC-103736 but just the toolchain because I'm not interested in processor expert.
Since I'm working on Linux I didn't installed the Code Sourcery thing, instead I'm working with the gcc-arm-none-eabi which I installed using:
$ sudo apt-get install gcc-arm-none-eabi
And therefore I had to change the cs-rm and cs-make for rm and make respectively.
And I was able to create an eclipse project with the downloaded code and configure the project to make it work, nevertheless, I had the first error:
main.c:8:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
make: *** [cortex_A9/main.o] Error 1
cortex_A9/subdir.mk:24: recipe for target 'cortex_A9/main.o' failed
And I was able to solve it adding "/usr/include" in the include directories at project > properties. But I'm not sure if this is a correct way of solving this error.
After fixing this error I got a new one:
syscalls.c:168:1: error: unknown type name 'caddr_t'
caddr_t _sbrk(int incr)
And for solving that I had to include explicitly the file "/usr/include/x86_64-linux-gnu/sys/types.h" and also I don't know if that is the correct way to solve it.
Now having eliminated those two errors I have the following one:
Building target: imx6-A9.elf
Invoking: Cross ARM C Linker
arm-none-eabi-gcc -mcpu=cortex-a9 -march=armv7-a -marm -mlittle-endian -mfloat-abi=softfp -mfpu=neon -mno-unaligned-access -fno-zero-initialized-in-bss -O0 -g -T "/home/mmalagon/iMX6/MX6SX_hello_MFG/cortex_A9/mx6slx.ld" -nostartfiles -Wl,-Map,"imx6-A9.map" -o "imx6-A9.elf" ./cortex_A9/main.o ./cortex_A9/syscalls.o ./cortex_A9/uart.o
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: cannot find -lg
makefile:42: recipe for target 'imx6-A9.elf' failed
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [imx6-A9.elf] Error 1
Which I haven't been able to resolve.
I don't know if this error is a consequence of the way I solved the two previous errors.
Does anybody know how to properly setup eclipse for i.MX6 bare-metal development?
Thank you very much for helping!!
If you want to develop bare-metal code for the i.MX6SoloX without using CodeSourcery then you need to execute this:
sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi -y
And then choose "Custom (arm-none-eabi-gcc)" at Project>Settings>C/C++ Build in the 'Toolchains' tab.

linker error - cross compile for Beaglebone Black on Debian (Jessie) using Eclipse 3.8.1

I am trying to get a basic cross compiler for the BeagleBone Black setup.
I tried to follow this tutorial but ran into some snags...
When dowloading the toolchain for the arm platform the tutorial showed the "gcc-arm-linux-gnueabi" as a package for Ubunto so I figutred there would be one for Debian... No dice, the closest I could find is the "arm-none-eabi" package. Being new to this I gave it a shot.
I made a simpe "Hello World" application as the tutorial suggested and it compiles under the standard tools. Under the cross tools however, I add the prefix amr-none-eabi- and the path /usr/bin/ the following is the result of the build.
make all
Building file: ../src/test.cpp
Invoking: Cross G++ Compiler
arm-none-eabi-g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP MF"src/test.d" -MT"src/test.d" -o "src/test.o" "../src/test.cpp"
Finished building: ../src/test.cpp
Building target: test
Invoking: Cross G++ Linker
arm-none-eabi-g++ -o "test" ./src/test.o
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
makefile:45: recipe for target 'test' failed
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-abort.o): In function `abort':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/abort.c:63: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-openr.o): In function `_open_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/openr.c:59: undefined reference to `_open'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/sbrkr.c:58: undefined reference to `_sbrk'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-signalr.o): In function `_kill_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/signalr.c:61: undefined reference to `_kill'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-signalr.o): In function `_getpid_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/signalr.c:96: undefined reference to `_getpid'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/writer.c:58: undefined reference to `_write'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/closer.c:53: undefined reference to `_close'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/reent/../../../../../newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: error: ld returned 1 exit status
make: *** [test] Error 1
18:18:55 Build Finished (took 564ms)`
I can't seem to find anyhting that works to remove these errors. I would greatly appreciate any guidence I can get on this. I'm using Debian 8.1.0 and it is up to date.
I figured this out and my mistake was to use the wrong toolchain...
Linaro makes a toolchain for the hard float arm architecture.
Simply get the linked archive, extract it, and point eclipse in the right direction. I've now got eclipse to proerly build programs for the beaglebone. I've also got eclipse to properly connect to the remote application on the BBB.
Cheers,

cross compiling opencv with eclipse in ubuntu

I am able to cross compile hello world program in raspberry pi from my Ubuntu 14.04 PC through eclipse. But I am not able to cross compile opencv programs. I am getting following error:
15:19:20 ** Incremental Build of configuration Debug for project MyFirstRaspProg **
make all
Building target: MyFirstRaspProg
Invoking: Cross G++ Linker
arm-linux-gnueabi-g++ -L/home/tvsm/raspberry -L/usr/lib/gcc-cross/arm-linux-gnueabi/4.7 -L/usr/lib/i386-linux-gnu/lib -L/usr/arm-linux-gnueabi/lib -o "MyFirstRaspProg" ./src/MyFirstRaspProg.o -lopencv_highgui
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lopencv_highgui
collect2: error: ld returned 1 exit status
make: * [MyFirstRaspProg] Error 1
15:19:20 Build Finished (took 56ms)
Can anyone help how to resolve this?
The error is because you have specified arm-linux-gnueabi-g++ to refer a library, which is not available. So you need to cross compile the necessary library for ARM platform and link it during build.
Follow the below link to cross compile the opencv on Ubuntu machine.
http://www.ridgesolutions.ie/index.php/2013/05/24/building-cross-compiling-opencv-for-linux-arm/
You will be left with an "install" folder at the end of the process.
In eclipse specify the library path and include path to "lib" & "include" folders in the "install" folder respectively.