0

I'm having problems creating a lib and using it to link a .c-file with a main-function.

I have e.g.

cfile1.c
cfile2.c
cfile3.c
program.c (with main-function)

I want to create a library from all the .c-files and use it to link the

program.c

What is the best way to do that?

tobkunz11
  • 15
  • 2
  • There are *shared* libraries and also *static* libraries. They're very different things, built in different ways, and linking a program with a shared lib means something quite different from linking with a static lib. So you need to make it clear in your question which you are trying to build. Show what you have tried and what has gone wrong. – Mike Kinghan Feb 14 '17 at 18:39

1 Answers1

0

I assume your program.c (which is main) need those *.c files(support) to make a new library. If is that so, may be you should compile all of them because your program.c need that (if there is a function on *.c files called on program.c files)

I think, you can take a look on this link below:

Including one C source file in another?

Hope it helps, CMIIW

Community
  • 1
  • 1