User forums > Help

"undefined reference" error with basic code

(1/1)

geohei:
Hi.

This is driving me nuts!
I'm not sure if this is Code::Blocks related !!!
If not, just tell me, and I dig further (since this is no general programming forum) !!!


--- Code: ---#include <stdio.h>
#include <stdlib.h>
#include <openssl/des.h>

DES_cblock Key1 = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 };
DES_cblock Key2 = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22 };
DES_cblock Key3 = { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33 };
DES_key_schedule SchKey1,SchKey2,SchKey3;

int main() {

    printf("key check = %i\n", DES_set_key_checked(&Key1, &SchKey1));
    return 0;

}
--- End code ---

openssl and libssl-dev are installed!

I get ...


--- Code: ---||=== Build: Debug in test (compiler: GNU GCC Compiler) ===|
obj/Debug/main.o||In function `main':|
/home/geohei/Desktop/programming/test/main.c|68|undefined reference to `DES_set_key_checked'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

--- End code ---

What do I miss in Code::Blocks (if related)?

Miguel Gimenez:
You should link with the library containing DES_set_key_checked(), probably called libdes.a

geohei:
I hardly dare to say what it was ...
I added -lcrypt i.s.o. -lcrypto to the linker option.
Shame ...

Navigation

[0] Message Index

Go to full version