suuz
suuz

Reputation: 13

Compilation gcc error undefined reference to `aes256_init'

I tried compiling using gcc it gives me

$ gcc demo.c -o samp.o

/tmp/cclnweNC.o: In function `main':
demo.c:(.text+0x12b): undefined reference to `aes256_init'
demo.c:(.text+0x142): undefined reference to `aes256_encrypt_ecb'
demo.c:(.text+0x1b2): undefined reference to `aes256_init'
demo.c:(.text+0x1c9): undefined reference to `aes256_decrypt_ecb'
demo.c:(.text+0x222): undefined reference to `aes256_done'
collect2: ld returned 1 exit status

I have file called aes256.h in this i have initialized all the function, the body of these function are in aes256.c and tried compile my main file demo.c it shows the above error

Upvotes: 0

Views: 614

Answers (2)

gandgandi
gandgandi

Reputation: 330

If you want to compile only use '-c' flag:

gcc -c main.c -o ...

If you want to create executable, then you have to compile aes256.c first, and then:

gcc -c aes256.c -o aes256.o
gcc main.c aes256.o -o ... 

Upvotes: 0

lbolla
lbolla

Reputation: 5411

You want something like:

$> gcc demo.c aes256.c -o demo

Upvotes: 1

Related Questions