gcc Link Order issue

2019-07-08 02:56发布

问题:

I am currently having problems compiling with the following line:

gcc test.c -I/usr/include -L/lib -lipc -lpcd -lrt -o /home/examples/bin/test

I was suggested to group them using start-group and end-group.

I am not able to get the proper syntax.

I think i need this part, but what do the whole line look like?

-Wl,--start-group -lipc -lpcd -lrt -Wl,--end-group

回答1:

Which problem are you having ?

Anyway, try putting the linker arguments at the end:

gcc test.c -o /home/examples/bin/test -I/usr/include -L/lib -lipc -lpcd -lrt


标签: c linux gcc linker