Find the answer to your Linux question:
Results 1 to 2 of 2
Using putty I created 5 files: main.cpp, employee.cpp, address.cpp, employee.h, and address.h I have a file that will invoke the make command, but need to build a makefile with an ...
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Posts
    2

    makefile

    Using putty I created 5 files: main.cpp, employee.cpp, address.cpp, employee.h, and address.h

    I have a file that will invoke the make command, but need to build a makefile with an executable file named myprogram.

    How do I do this? What will the make file look like?
    Sorry I'm very new to all of this and any help would be very nice.

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    951
    Quote Originally Posted by getitgriffy View Post
    Using putty I created 5 files: main.cpp, employee.cpp, address.cpp, employee.h, and address.h

    I have a file that will invoke the make command, but need to build a makefile with an executable file named myprogram.

    How do I do this? What will the make file look like?
    Sorry I'm very new to all of this and any help would be very nice.
    Well, it would be something like:
    Code:
    main.o: main.cpp
           g++ (some options) -c -o main.o main.cpp
    employee.o: employee.cpp employee.h
           g++ (some options) -c -o employee.o employee.cpp
    address.o: address.cpp address.h
           g++ (some options) -c -o address.o address.cpp
    all: main.o employee.o address.o
           ld (libraries, etc) main.o employee.o address.o -o myprogram
    I have no idea what the options and libraries are for a C++ program. You'll have to look them up.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •