Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- himake: hello.o printing.o name.o
- g++ -o himake hello.o printing.o name.o
- hello.o: hello.cpp
- g++ -c hello.cpp
- printing.o: printing.cpp
- g++ -c printing.cpp
- name.o: name.cpp
- g++ -c name.cpp
- // hello.cpp
- // standard library
- #include <iostream>
- #include <string>
- using namespace std;
- // user defined header files
- #include "name.h"
- #include "printing.h"
- int main ()
- {
- string name;
- name = getName(); // getName is in name.h
- printHello(name); // printHello is in print.h
- return 0;
- }
- // printing.cpp
- // user defined include files
- #include "printing.h"
- void printGreeting(void)
- {
- cout << "Your name: ";
- return;
- }
- void printHi (string name)
- {
- cout << "Hi, " << name << endl;
- return;
- }
- // name.h
- #include <iostream>
- using namespace std;
- string getName();
- // printing.cpp
- // user defined include files
- #include "printing.h"
- void printGreeting(void)
- {
- cout << "Your name: ";
- return;
- }
- void printHi (string name)
- {
- cout << "Hi, " << name << endl;
- return;
- }
- // printing.h
- #include <iostream>
- using namespace std;
- void printGreeting();
- void printHello(string);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement