Mani G
Mani G

Reputation: 89

Make file to compile two C program files

I have two C program files named client.c and server.c. Both of these contains main function. I am having trouble in compiling them using g++ with makefile.

all:
    g++ client.c server.c -o client server.c

Upvotes: 0

Views: 660

Answers (1)

Mani G
Mani G

Reputation: 89

I have figured it out since these are the two different files so they should be compiled separately like this.

all: client server

client:
       g++ -o client client.c

server:
       g++ -o server server.c

Upvotes: 1

Related Questions