c - link a library I wrote with pthread library -


this part of assignment. basically, need write library, linked against test programs professor writes, so:

gcc -o libexample.o -c libexample.c ar rvs libexample.a libexample.o  #later gcc -o test test.c -l . -lexample 

the thing libexample uses posix semaphores, needs linking pthread library when generating final executable. without changing way test program compiles, there way package pthread library libexample.a?

thanks!

without changing way test program compiles, there way package pthread library libexample.a?

no.

are restricted supplying single libexample.a file?

if not (and if using gnu linker), possible solution provide libexample.a linker script, link against e.g. libexample_code.a containing object files and add -lpthread.


Comments

Popular posts from this blog

angularjs - Showing an empty as first option in select tag -

qt - Change color of QGraphicsView rubber band -

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -