I have to compile a C program on linux(ubuntu) with gcc. Which is dependent to openssl libraries.
#include <openssl/crypto.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/bio.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/err.h>
I've downloaded libcrypto and libopenssl package from repository. But still I'm getting this error
root#kali:~/openssl# gcc opensslhello.c
/tmp/ccTahV7g.o: In function `pem2X509':
opensslhello.c:(.text+0x15): undefined reference to `BIO_s_mem'
opensslhello.c:(.text+0x1d): undefined reference to `BIO_new'
opensslhello.c:(.text+0x4e): undefined reference to `BIO_write'
opensslhello.c:(.text+0x71): undefined reference to `PEM_read_bio_X509'
opensslhello.c:(.text+0x7f): undefined reference to `BIO_free'
/tmp/ccTahV7g.o: In function `sendHelloFunction':
opensslhello.c:(.text+0xb9): undefined reference to `X509_STORE_new'
opensslhello.c:(.text+0xe2): undefined reference to `X509_STORE_add_cert'
opensslhello.c:(.text+0x106): undefined reference to `X509_STORE_add_cert'
opensslhello.c:(.text+0x113): undefined reference to `sk_new_null'
opensslhello.c:(.text+0x13c): undefined reference to `sk_push'
opensslhello.c:(.text+0x160): undefined reference to `sk_push'
opensslhello.c:(.text+0x187): undefined reference to `X509_STORE_CTX_new'
opensslhello.c:(.text+0x1b0): undefined reference to `X509_STORE_CTX_init'
opensslhello.c:(.text+0x1bf): undefined reference to `X509_verify_cert'
opensslhello.c:(.text+0x1d3): undefined reference to `X509_STORE_CTX_get_error'
opensslhello.c:(.text+0x1e3): undefined reference to `X509_STORE_CTX_get_error'
opensslhello.c:(.text+0x215): undefined reference to `X509_STORE_CTX_free'
opensslhello.c:(.text+0x220): undefined reference to `X509_free'
opensslhello.c:(.text+0x22b): undefined reference to `BIO_free'
opensslhello.c:(.text+0x233): undefined reference to `X509_free'
opensslhello.c:(.text+0x23e): undefined reference to `sk_pop_free'
opensslhello.c:(.text+0x249): undefined reference to `X509_STORE_free'
/tmp/ccTahV7g.o: In function `main':
opensslhello.c:(.text+0x291): undefined reference to `EVP_cleanup'
opensslhello.c:(.text+0x29d): undefined reference to `ERR_remove_state'
opensslhello.c:(.text+0x2a2): undefined reference to `ERR_free_strings'
collect2: error: ld returned 1 exit status
root#kali:~/openssl#
Can anyone please tell me what I should do to, get rid of this error.?
Thanks,
You haven't linked the crypto and openssl libraries:
gcc opensslhello.c -lssl -lcrypto
Related
I am trying to use C, MINGW and GLFW to create a program and I keep on getting this error when compiling.
cc1.exe: warning: unrecognized gcc debugging option: y
cc1.exe: warning: unrecognized gcc debugging option: n
cc1.exe: warning: unrecognized gcc debugging option: m
cc1.exe: warning: unrecognized gcc debugging option: i
cc1.exe: warning: unrecognized gcc debugging option: c
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x127): undefined reference to `CreateDCW#16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x160): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x179): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1ca): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x24b): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x291): undefined reference to `DeleteDC#4'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x9ee): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xa07): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xe9f): undefined reference to `CreateDCW#16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xeba): undefined reference to `GetDeviceGammaRamp#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xec8): undefined reference to `DeleteDC#4'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x100e): undefined reference to `CreateDCW#16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1029): undefined reference to `SetDeviceGammaRamp#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1037): undefined reference to `DeleteDC#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1f3): undefined reference to `CreateDIBSection#24'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x262): undefined reference to `CreateBitmap#20'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x28d): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x37b): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x389): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xb55): undefined reference to `CreateRectRgn#16'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xc2c): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x6c4): undefined reference to `DescribePixelFormat#16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xbbd): undefined reference to `DescribePixelFormat#16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xf46): undefined reference to `SwapBuffers#4'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1254): undefined reference to `ChoosePixelFormat#8'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x126f): undefined reference to `SetPixelFormat#12'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1592): undefined reference to `DescribePixelFormat#16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15d9): undefined reference to `SetPixelFormat#12'
collect2.exe: error: ld returned 1 exit status
This is my code
#include "GLFW/glfw3.h"
#include <stdio.h>
#define GLFW_INCLUDE_GLCOREARB
int main() {
GLFWwindow* window;
if (!glfwInit()) return -1;
window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window))
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
So its basically just the given example on glfw website.
I use this command to build:
gcc -o Test.o Main.c -IGLFW -IGL -dynamic ./libs/glfw3.dll ./libs/glew32.dll -lopengl32 -static ./libs/libglfw3.a ./libs/glew32.lib ./libs/glew32s.lib
I dont have any issues with compiling the glfw but I have problems with GLEW, maybe it is because it is lib files instead of a.
I'm using Mingw's gcc compiler but when I started using the -std options, the linker started complaining about references (except for -std=gnuXX).
I can't find anything about this (maybe I'm really bad at research) because most of the results are on linux and/or relate to other problems with ld..
Here is the command I typed :
gcc src/main.c -o bin/main.exe -std=c11 The same occurs with c89,c99,c17 etc..
Here is my test code :
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
printf("Cool\n");
return EXIT_SUCCESS;
}
Here is the command output
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(mbrscan.o):(.text+0xb6):
undefined reference to `SetLastError#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(wcharmap.o):(.text+0x208): undefined reference to `WideCharToMultiByte#32'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingwex.a(codeset.o):(.text+0xbe):
undefined reference to `GetCPInfo#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingwex.a(codeset.o):(.text+0x143): undefined reference to `GetCPInfo#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_init_function':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:639: undefined reference to `CreateSemaphoreW#16'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_key_create':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:590: undefined reference to `TlsAlloc#0'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:597: undefined reference to `__mingwthr_key_dtor'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_getspecific':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:621: undefined reference to `SetLastError#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_lock':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:655: undefined reference to `InterlockedIncrement#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_unlock':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:689: undefined reference to `InterlockedDecrement#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:690: undefined reference to `ReleaseSemaphore#12'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_setspecific':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:629: undefined reference to `TlsSetValue#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_once':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:562: undefined reference to `InterlockedIncrement#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_lock':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:656: undefined reference to `WaitForSingleObject#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:662: undefined reference to `InterlockedDecrement#4'
collect2.exe: error: ld returned 1 exit status
I'm also wondering if I should use Mingw-w64 or Clang/LLVM instead.. ?
EDIT : It works fine with Mingw-w64 so I switched, thanks !
I am new to Opencl Programming. I have written a matrix multiplication program while compiling it is giving me error
My include files are:
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#include <CL/cl.h>
#include <stdbool.h>
But I got an error as:
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0x2d3): undefined reference to `clGetPlatformIDs'
/usr/bin/ld: gmm.c:(.text+0x2ef): undefined reference to `clGetPlatformIDs'
/usr/bin/ld: gmm.c:(.text+0x322): undefined reference to `clGetDeviceIDs'
/usr/bin/ld: gmm.c:(.text+0x376): undefined reference to `clCreateContext'
/usr/bin/ld: gmm.c:(.text+0x527): undefined reference to `clCreateCommandQueue'
/usr/bin/ld: gmm.c:(.text+0x5ab): undefined reference to `clCreateProgramWithSource'
/usr/bin/ld: gmm.c:(.text+0x5fc): undefined reference to `clBuildProgram'
/usr/bin/ld: gmm.c:(.text+0x64c): undefined reference to `clGetProgramBuildInfo'
/usr/bin/ld: gmm.c:(.text+0x682): undefined reference to `clCreateKernel'
/usr/bin/ld: gmm.c:(.text+0x6dc): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x70c): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x73c): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x76e): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x7a0): undefined reference to `clCreateBuffer'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0x7d2): more undefined references to `clCreateBuffer' follow
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0x84c): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x875): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x89e): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x8c7): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x8f8): undefined reference to `clSetKernelArg'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0x929): more undefined references to `clSetKernelArg' follow
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0xa58): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xa9f): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xae6): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xb04): undefined reference to `clWaitForEvents'
/usr/bin/ld: gmm.c:(.text+0xb13): undefined reference to `clFinish'
/usr/bin/ld: gmm.c:(.text+0xb3c): undefined reference to `clGetEventProfilingInfo'
/usr/bin/ld: gmm.c:(.text+0xb65): undefined reference to `clGetEventProfilingInfo'
/usr/bin/ld: gmm.c:(.text+0xc9f): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcae): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcbd): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xccc): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcdb): undefined reference to `clReleaseMemObject'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0xcea): more undefined references to `clReleaseMemObject' follow
collect2: error: ld returned 1 exit status
I am compiling program by this statement:gcc -o gmmc gmm.c. Can anyone help me
Link your program with the OpenCL library:
gcc -O2 -Wall -o gmmc gmmc.c -lOpenCL
If this doesn't find the library, you need to pass the path to it:
gcc -O2 -Wall -o gmmc gmmc.c -L/insert/path/here -lOpenCL
where /insert/path/here is the directory that contains libOpenCL.so. You can search a directory for it, e.g.
find /usr/lib -name libOpenCL.so
I am having a opencv code in C:
#ifdef _CH_
#pragma package <opencv>
#endif
#ifndef _EiC
// motion templates sample code
#include "cv.h"
#include "highgui.h"
#include <time.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h>
#endif
with these header files.
if I run it using
gcc `pkg-config --cflags --libs opencv` motempl_temp.c -o opencv
I get error:
/tmp/cc2rKXbX.o: In function `cvDecRefData':
motempl_temp.c:(.text+0xac2): undefined reference to `cvFree_'
motempl_temp.c:(.text+0xb4b): undefined reference to `cvFree_'
/tmp/cc2rKXbX.o: In function `cvGetRow':
motempl_temp.c:(.text+0xc63): undefined reference to `cvGetRows'
/tmp/cc2rKXbX.o: In function `cvGetCol':
motempl_temp.c:(.text+0xc91): undefined reference to `cvGetCols'
/tmp/cc2rKXbX.o: In function `cvReleaseMatND':
motempl_temp.c:(.text+0xcab): undefined reference to `cvReleaseMat'
/tmp/cc2rKXbX.o: In function `cvSubS':
motempl_temp.c:(.text+0xe08): undefined reference to `cvAddS'
/tmp/cc2rKXbX.o: In function `cvCloneSeq':
motempl_temp.c:(.text+0xe5a): undefined reference to `cvSeqSlice'
/tmp/cc2rKXbX.o: In function `cvSetNew':
motempl_temp.c:(.text+0xed6): undefined reference to `cvSetAdd'
/tmp/cc2rKXbX.o: In function `cvGetSetElem':
motempl_temp.c:(.text+0xf93): undefined reference to `cvGetSeqElem'
/tmp/cc2rKXbX.o: In function `cvEllipseBox':
motempl_temp.c:(.text+0x1062): undefined reference to `cvEllipse'
/tmp/cc2rKXbX.o: In function `cvFont':
motempl_temp.c:(.text+0x10ce): undefined reference to `cvInitFont'
/tmp/cc2rKXbX.o: In function `cvReadIntByName':
motempl_temp.c:(.text+0x11d8): undefined reference to
`cvGetFileNodeByName'
/tmp/cc2rKXbX.o: In function `cvReadRealByName':
motempl_temp.c:(.text+0x1277): undefined reference to
`cvGetFileNodeByName'
/tmp/cc2rKXbX.o: In function `cvReadStringByName':
motempl_temp.c:(.text+0x1306): undefined reference to
`cvGetFileNodeByName'
/tmp/cc2rKXbX.o: In function `cvReadByName':
motempl_temp.c:(.text+0x1349): undefined reference to
`cvGetFileNodeByName'
collect2: error: ld returned 1 exit status
All the header files are in the path /usr/local/include/opencv folder and this is included in the path variable.
The OpenCV C API is deprecated. You should use the C++ API.
You can compile your code with g++:
g++ motempl_temp.c -o opencv `pkg-config opencv --cflags --libs`
I have included the following header files in a C code using openssl libraries.
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#ifdef __VMS
#include <in.h>
#include <inet.h>
#else
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include <openssl/crypto.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
Then I compiled the program using gcc -o openssl -lssl -lcrypt openssl.c
In my office this code compiled and run fine but in my house system(both are linux- debian 6 in office and Ubuntu 12.04 at home), it gave the following error:
/tmp/ccZcmLk4.o: In function `main':
server.c:(.text+0x3d): undefined reference to `SSL_library_init'
server.c:(.text+0x42): undefined reference to `SSL_load_error_strings'
server.c:(.text+0x47): undefined reference to `SSLv3_method'
server.c:(.text+0x57): undefined reference to `SSL_CTX_new'
server.c:(.text+0x6f): undefined reference to `ERR_print_errors_fp'
server.c:(.text+0x97): undefined reference to `SSL_CTX_use_certificate_file'
server.c:(.text+0xa8): undefined reference to `ERR_print_errors_fp'
server.c:(.text+0xd0): undefined reference to `SSL_CTX_use_PrivateKey_file'
server.c:(.text+0xe1): undefined reference to `ERR_print_errors_fp'
server.c:(.text+0xf9): undefined reference to `SSL_CTX_check_private_key'
server.c:(.text+0x154): undefined reference to `SSL_CTX_load_verify_locations'
server.c:(.text+0x165): undefined reference to `ERR_print_errors_fp'
server.c:(.text+0x18d): undefined reference to `SSL_CTX_set_verify'
server.c:(.text+0x1a1): undefined reference to `SSL_CTX_set_verify_depth'
server.c:(.text+0x397): undefined reference to `SSL_new'
server.c:(.text+0x3c2): undefined reference to `SSL_set_fd'
server.c:(.text+0x3ce): undefined reference to `SSL_accept'
server.c:(.text+0x3e6): undefined reference to `ERR_print_errors_fp'
server.c:(.text+0x3fe): undefined reference to `SSL_get_current_cipher'
server.c:(.text+0x406): undefined reference to `SSL_CIPHER_get_name'
server.c:(.text+0x42e): undefined reference to `SSL_get_peer_certificate'
server.c:(.text+0x455): undefined reference to `X509_get_subject_name'
server.c:(.text+0x46d): undefined reference to `X509_NAME_oneline'
server.c:(.text+0x4b1): undefined reference to `X509_get_issuer_name'
server.c:(.text+0x4c9): undefined reference to `X509_NAME_oneline'
server.c:(.text+0x50d): undefined reference to `X509_free'
server.c:(.text+0x593): undefined reference to `SSL_write'
server.c:(.text+0x5ab): undefined reference to `ERR_print_errors_fp'
server.c:(.text+0x5d3): undefined reference to `SSL_read'
server.c:(.text+0x5eb): undefined reference to `ERR_print_errors_fp'
collect2: ld returned 1 exit status
I understand that this is due to the absence of certain libraries in my home PC. But can anyone tell me which libraries I need to install for this? Thanks in advance.
Put the libraries after the source file:
gcc -o openssl openssl.c -lssl -lcrypto
See: http://www.network-theory.co.uk/docs/gccintro/gccintro_18.html
put the file name before -l option