请教一个简单的 makefile 怎么写
// ./a/a.h
#ifndef a_h
#define a_h
#include <iostream>
using namespace std ;
class a
{
public :
~a();
void fa();
public:
int i ;
};
#endif
// ./a/a.cpp
#include "a.h "
void a::fa()
{
cout < < "In ./a/a.cpp " < <endl;
}
a::~a()
{
}
// ./b/b.h
#ifndef b_h
#define b_h
#include <iostream>
#include "..\a\a.h "
using namespace std;
class a;
class b
{
a oa;
public:
void fb();
};
#endif
// ./b/b.cpp
#include "b.h "
void b::fb()
{
cout < < "In ./b/b.cpp " < <endl;
cout < < "and invoke class a 's fa() function " < <endl;
oa.fa();
cout < < "invoke class a 's fa() function over! " < <endl;
}
// ./test.cpp
#include "./b/b.h "
int main( void )
{
b ob;
ob.fb();
cout < < "ok " < <endl ;
}
我下面的代码通不过:
test: test.o a.o b.o
g++ test.o a.o b.o test
a.o : ./a/a.cpp ./a/a.h
g++ -c ./a/a.cpp -o a.o
b.o : ./a/a.h ./b/b.cpp ./b/b.h
g++ -c ./b/b.cpp -o b.o
------解决方案--------------------去学习一下,早晚的事
http://dev.csdn.net/develop/article/20/20025.shtm
------解决方案--------------------最典型的,前面不能用空格,要用table
------解决方案--------------------是否需要包含路径