在dev c ++上编译c ++时出现makefile.win错误

时间:2015-04-30 06:25:01

标签: c++ dev-c++

我试图在dev c ++中使用我自己定义的头文件运行我的代码。

但是当我编译它时会出现这个错误:

25      C:\Users\ali\Desktop\hw2\Makefile.win   recipe for target 'tar.exe' failed

它指向makefile.win中的这一行:

    $(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)

此外,我已将文件添加到项目中: 的main.cpp&安培; post.cpp&安培; post.h

这是我的代码(只有PostBox类):

头文件中的

#include <iostream>
#include <string>
using namespace std;

#ifndef P
#define P
class PostBox{
friend void Send(PostBox);
public:
    int getcount();
    void Count();
    PostBox(string,float,int,Person,Person);
    PostBox();
    void setID(string);
    void setweight(float);
    void setsender(Person);
    void setreceiver(Person);
    void cost();
    string getid();
    Person getsender();
    Person getreceiver();
protected:
    static int count;
    string id;
    float weight;
    int price;
    Person sender;
    Person receiver;
};
 #endif

在我的cpp文件中:

#include <iostream>
#include "post.h"
using namespace std;
PostBox::PostBox(string id,float weight,int price,Person sender,Person      receiver)
{
this->count=0;
this->id=id;
this->weight=weight;
this->price=price;
this->sender=sender;
this->receiver=receiver;
} 

1 个答案:

答案 0 :(得分:0)

您错过了static int ::count的声明。

将这样的内容放入cpp文件int PostBox::count = 0