A.nechi A.nechi - 1 year ago 92
C Question

C application wont be linked dynamically

I have a C application: FFT that is linked dynamically with eclipse but seeing the fact that I'm using a simulator that only deals with statically linked application i had to add the "-static" flag in my Makefile as following:

CFLAGS=-g -static -c -Wall -O5 -mavx

SOURCES=$ fft.c



$(CC) $(LDFLAGS) $(OBJECTS) -lm -o $@

$(CC) $(CFLAGS) $< -lm -o $@


Normally the static link should work but when i type the following command:

:~/workspace/fft$ file fft

I get this message:

fft: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xa499c8104f09cd85fbfbb33c75e51c606f117acf, not stripped

could someone help me on this?

Answer Source

You need to add the -static flags to the LDFLAGS section.

You also don't need -static flags in the CFLAGS.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download