compiling more than 2 C files
-
Hi All, I m fighting against a problem that drove me crazy for long hours, I wanna create a simple prog like Client/Server under linux using C code. I wrote a Server.c and Client.c Files but when i type $gcc -c Server.c Client.c $gcc -o Blood *.o it told me that there is a double declarion of the function main So could some one tell me how could i test my prog on the same mchine ??? (local) Thank you !!!! i Need Help so plz !!!
"The Ultimate Limit Is Only Your Imagination."
-
Hi All, I m fighting against a problem that drove me crazy for long hours, I wanna create a simple prog like Client/Server under linux using C code. I wrote a Server.c and Client.c Files but when i type $gcc -c Server.c Client.c $gcc -o Blood *.o it told me that there is a double declarion of the function main So could some one tell me how could i test my prog on the same mchine ??? (local) Thank you !!!! i Need Help so plz !!!
"The Ultimate Limit Is Only Your Imagination."
Blood_HaZaRd wrote:
$gcc -c Server.c Client.c $gcc -o Blood *.o it told me that there is a double declarion of the function main
Did you try this? $gcc -c Server.c Client.c $gcc -o blood_server Server.o $gcc -o blood_client Client.o
My webchat in Europe :java:
-
Blood_HaZaRd wrote:
$gcc -c Server.c Client.c $gcc -o Blood *.o it told me that there is a double declarion of the function main
Did you try this? $gcc -c Server.c Client.c $gcc -o blood_server Server.o $gcc -o blood_client Client.o
My webchat in Europe :java:
Ok i asked my professor and here what he told me to do: after compiling the 2 files: $gcc - client client.c $gcc - server server.c i ha to add a & when calling ther server: $./server & then i run the clien $./client that's all. i didn't try it yet but i hope that it'll works. Thank you All for your Help. I appreciate it Well. :rose:
"The Ultimate Limit Is Only Your Imagination."
-
Hi All, I m fighting against a problem that drove me crazy for long hours, I wanna create a simple prog like Client/Server under linux using C code. I wrote a Server.c and Client.c Files but when i type $gcc -c Server.c Client.c $gcc -o Blood *.o it told me that there is a double declarion of the function main So could some one tell me how could i test my prog on the same mchine ??? (local) Thank you !!!! i Need Help so plz !!!
"The Ultimate Limit Is Only Your Imagination."
you will need to compile each file separately. each file creates a different exe, one will create a client exe and the other a server exe. each file has a main method, when you compile files together it to create a single exe, so what you are doing is incorrect. in short you can't have multiple definitions of a function, in your case that would be 'main' try: gcc -o server server.c gcc -o client client.c hope this helps :-D
--- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Deploy