Hi Im not sure if this question belongs in the form so sorry if it doesn't. Here is my question, in a cs class of mine we have to write a make file that compiles the two seperate programs in the project. The only problem is that none of the cs books I have mention how to do this and the prefessor didn't tell us, wanting us to learn on our own, and it goes without saying that I have never made my own make file before. So, after looking through the Internet for a few hours and even trying to read the make manuel, I came up with this.

all: client server

client: project2Client.cpp
        c++ project2Client.cpp -o client.exe

server: project2Server.cpp
        c++ project2Server.cpp -o server.exe

However this doesn't work. All I want to do is take the two individual files that are two seperate self contained (no headers or anything) and compile them both into two seperate programs that can be called with the ./client and ./server commands. If it makes any difference, I'm using the gnu gcc and make programs on windows xp but under the cygwin enviroment, CYGWIN_NT-5.1 version 1.7.16(0.262/5/3) to be specific. Any help would be appreciated.

Recommended Answers

All 3 Replies

Make is notorious for not working with spaces. The client: ... line should have - on the very next line - a command that starts with a single tab. If your editor expands tabs to spaces you will have problems. If you insert spaces you will have problems.

Ok, thanks for the help with what you guys said and checking some configuration I got it to work just fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.