I am developing a small client / server application in C. At the moment I was calling gcc by hand and using my own make files. I had two main()
functions, one in server.c
and other in client.c
.
I imported all the files I had in my project's folder into Eclipse, but when trying to compile it warned me that I had multiple definitions of main. I understand that a given executable should have a single main()
function, but in this case I'd like to have 2, so I can run the server and the client, being that they share almost all the other .c
files.
How to solve this? The only idea that comes to mind is to separate this in 2 (maybe 3?) projects? I'll want to run both the server and the client concurrently and I'd like to do so (if possible) through Eclipse itself.
Thanks
Edit:
makefile:
table-client: client-lib.o
gcc -o tabela-client table_client.c table.c base64.c list.c client-lib.o
table-server:
gcc -o tabela-server table_server.c message.c base64.c entry.c data.c table_skel.c table.c list.c
client-lib.o:
gcc -c remote_table.c network_client.c message.c data.c entry.c
ld -r data.o entry.o message.o network_client.o remote_table.o -o client-lib.o
clean:
rm -f tabela-server
rm -f tabela-client
rm -f *.o