2014-10-10 40 views
0

這是我的錯誤錯誤有關的一類我甚至不具有

「/庫/開發商/ CommandLineTools在/ usr/bin中/使」 -f nbproject文件/ Makefile-Debug.mk QMAKE =子項目= * .build-conf */Library/Developer/CommandLineTools/usr/bin/make「-f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/practice3 make [2]:*構建/調試/ GNU-MacOSX/newClass.o'。停止。 化妝[1]:* [.build設置]錯誤2 化妝:*** [.build-IMPL]錯誤2

製作這個節目,我也的確讓所謂的NewClass上課前幾分鐘,不小心,但後來我刪除了它,並且無法在我的計算機(mac)上找到它。

這裏是我的程序,如果它是造成這個錯誤信息的所有,我不認爲它應該做的,因爲它根本沒有調用newClass類。

的main.cpp

#include <iostream> 
#include "Birthday.h" 
#include "People.h" 

using namespace std; 

int main() { 

    Birthday birthObj(1,28,2000); 

    People sebA("Sebastian A", birthObj); 
    sebA.printInfo(); 


} 

Birthday.h

#ifndef BIRTHDAY_H 
#define BIRTHDAY_H 
using namespace std; 

class Birthday { 
public: 
    Birthday(int m, int d, int y); 
    void printDate(); 
private: 
    int month; 
    int day; 
    int year; 

}; 

#endif 

Birthday.cpp

#include "Birthday.h" 
#include <iostream> 
using namespace std; 


Birthday::Birthday(int m, int d, int y) { 
    month = m; 
    day = d; 
    year = y; 

} 

void Birthday::printDate() { 
    cout << day << "/" << month << "/" << year << endl; 
} 

People.h

#ifndef PEOPLE_H 
#define PEOPLE_H 

#include <string> 
#include "Birthday.h" 
using namespace std; 

class People { 
public: 
    People(string x, Birthday bo); 
    void printInfo(); 
private: 
    string name; 
    Birthday dateOfBirth; // dateOfBirth is an object 

}; 

#endif 

People.cpp

#include <iostream> 
#include "Birthday.h" 
#include "People.h" 
using namespace std; 

People::People(string x, Birthday bo) 
: name(x), dateOfBirth(bo) 
{ 


} 

void People::printInfo(){ 
    cout << name << " was born on "; 
    dateOfBirth.printDate(); 
} 
+2

它是一個makefile問題。你是C++對我們毫無用處。 – IdeaHat 2014-10-10 16:43:16

+0

好的,你想要我補充什麼? – 2014-10-10 16:49:34

+0

不知道,與Netbeans的某種配置,但我不使用Netbeans。 – IdeaHat 2014-10-10 16:50:59

回答

0

可能make clean將修復它。或者至少明確地說是rm build/Debug/GNU-MacOSX/newClass.o

基本上,當你創建你的課程和編譯,你得到了一個.o它取決於它。但是,一旦你刪除的類,有可能是一些規則在你的makefile像

%.o : %.c 
    $(CC) ... 

所以make正在努力打造newClass.o取決於newClass.cpp不存在,所以你不要有一個規則,使之,因此錯誤。如果你只是刪除不需要的對象文件,一切都應該愉快地編譯。

+0

是的!現在運行,非常感謝:)是一個非常愚蠢的錯誤,我不知道如何解決。 – 2014-10-10 17:10:13

相關問題