Makefile, g++

I have literally been up all night working on this darn code, and I finally got it running right, but not I cannot get it to work into the makefile. Here is my makefile:

1
2
3
4
5
6
7
8
9
10
11
test.o: test.cpp                                                                                          
        g++ -c -Wall -Wextra -I. test.cpp                                                                 
                                                                                                          
                                                                                                          
id.o: id.h id.cpp                                                                                         
        g++ -c -Wall -Wextra -I.  id.cpp                                                                  
                                                                                                          
                                                                                                          
test.x: test.o id.o                                                                                       
        g++ -otest.x test.o id.o                                                                          
                                 


I have tried just about every combination to no avail. It is for an assignment for a class which I am taking online, and it's not covered in the book, but it's in the Supplemental Website, which I do not have access to because I bought my book used and the code had already been used. So basically I'm stuck trying to figure this out on my own and I'm lost. Here is part of my code( just the beginning of each file so you can see what is included):

test.cpp:

1
2
3
4
5
#include <cstdlib>                                                                                        
#include <iostream>                                                                                       
#include <iomanip>                                                                                        
#include "id.h"                                                                                           
#include "id.cpp" // in lieu of makefile     


id.h:

1
2
3
4
5
#ifndef _ID_h                                                                                             
#define _ID_h                                                                                             
                                                                                                          
                                                                                                          
class ID     


id.cpp:

1
2
3
4
5
6
#include <iostream>                                                                                       
#include "id.h"                                                                                           
#include <cstring>                                                                                        
#include <iomanip>                                                                                        
                                                                                                          
     


I'm getting this error when I call 'make':

g++ -c -Wall -Wextra -I id.cpp
g++: no input files
make: *** [id.o] Error 1


Someone please help me, I am so lost and about ready to give up on this. I've spent 50+ hours on this one assignment. Thanks in advance.
Last edited on
This line here
I'm getting this error when I call 'make':

g++ -c -Wall -Wextra -I id.cpp
g++: no input files
make: *** [id.o] Error 1


shows that you are missing the dot after the -I command, so make is thinking that the include
directory is id.cpp instead of the current directory - which would mean that the line would be missing the name of the actual file to be compiled - which would cause the "no input file error"

check your makefile closely.
Last edited on
Topic archived. No new replies allowed.