多个文件无效

时间:2014-08-10 14:39:59

标签: c++ netbeans

我正在学习C ++。我使用过多个文件(使用标题)。但现在,我正在创建一个简单的程序并且它无法运行。以下是我的程序中的所有文件+我的调试信息。

    //MAIN.CPP


#include <iostream>
#include <windows.h>
#include <string>
#include "second.h"
#include "minute.h"
using namespace std;


// Main interface that asks for type of timer.
int main()
{
    cout << "------------------------------ Welcome to xCount ------------------------------";      // Greets.
    Sleep(2500);        // Waits for 2500ms (2.5s).
    cout << " \nDo you want a SECOND[1] timer or a MINUTE[2] timer?";
    cout << "\n Please enter 1 for SECOND timer and 2 for a MINUTE timer.";
    char timee;
    cin >> timee;
    if (timee == 1)
    {
        cout << " \nPlease set the timer in seconds: ";       // Requests for the timer to be set.
        int time;       // Variable "time".
        cin >> time;    // Inputs the value to "time"
        Sleep(700);
        cout << "\nStarting the timer for " << time << " seconds...!";
        Sleep(800);
        cout << "\n\n** -- Make Sure your volume is turned up high! -- **\n";
        timer(time);    // Passes the value to function "timer".
    }
    if (timee == 2)
    {
        cout << " \nPlease set the timer in seconds: ";       // Requests for the timer to be set.
        int time;       // Variable "time".
        cin >> time;    // Inputs the value to "time"
        Sleep(700);
        cout << "\nStarting the timer for " << time << " minutes...!";
        Sleep(800);
        cout << "\n\n** -- Make Sure your volume is turned up high! -- **\n";
        timer2(time);    // Passes the value to function "timer".
    }
}



    //MINUTE.CPP


#include <iostream>
#include <windows.h>
#include <string>
#include "minute.h
using namespace std;

// A function that beeps 2 times every second.
int alarm2()
{
    unsigned int timez = 25000;     // timez is 25,000 now.
    while (timez > 1)               // While timez is more then one.
    {
        cout << "\a";               // Put out a beep.
        Sleep(500);                 // Wait for 500ms (0.5s).
        timez = timez - 1;          // Reduce one from timez.
    }
}

// A function that outputs the seconds remaining + counts the timer.
int timer2(int a)
{
    while (a > 0)                                                   // While a is bigger then 0 (a being the input value[of seconds that needs to be timed])
    {
        cout << "\n\nYou have " << a << " minutes remaining...";      // Outputs the remaining seconds.
        Sleep(60000);                                                // Waits for 60000ms (1m).
        a = a - 1;                                                  // Subtracts 1 from a.
    }
    cout << "\n\n\n\n\nTimes up!\a\a\a\a\a\a\a";                          // When times up, outputs *BEEPS* and text.
    cout << "\n\n\n\n\n\n\n\n\n\n\n                   -------  Please exit the program  -------  ";   // Requests to exit the program.
    Sleep(10000);                                                    // Waits for 10000ms (10s).
    alarm2();                                                        // If the program is still executing, outputs a *BEEP* 2 times every second.
}




    //SECOND.CPP


#include <iostream>
#include <windows.h>
#include <string>
#include "second.h"
using namespace std;

// A function that beeps 2 times every second.
int alarm()
{
    unsigned int timez = 25000;     // timez is 25,000 now.
    while (timez > 1)               // While timez is more then one.
    {
        cout << "\a";               // Put out a beep.
        Sleep(500);                 // Wait for 500ms (0.5s).
        timez = timez - 1;          // Reduce one from timez.
    }
}

// A function that outputs the seconds remaining + counts the timer.
int timer(int a)
{
    while (a > 0)                                                   // While a is bigger then 0 (a being the input value[of seconds that needs to be timed])
    {
        cout << "\n\nYou have " << a << " seconds remaining...";      // Outputs the remaining seconds.
        Sleep(1000);                                                // Waits for 1000ms (1s).
        a = a - 1;                                                  // Subtracts 1 from a.
    }
    cout << "\n\n\n\n\nTimes up!\a\a\a\a\a\a\a";                          // When times up, outputs *BEEPS* and text.
    cout << "\n\n\n\n\n\n\n\n\n\n\n                   -------  Please exit the program  -------  ";   // Requests to exit the program.
    Sleep(10000);                                                    // Waits for 10000ms (10s).
    alarm();                                                        // If the program is still executing, outputs a *BEEP* 2 times every second.
}




    //MINUTE.h

int timer(int a);
int alarm();


    //SECOND.h

int timer2(int b);
int alarm2();

我正在使用NetBeans IDE 8.0。 这是来自&#34;输出&#34;的信息。在构建(编译)之后:

  

&#34; /C/MinGW/MSYS/1.0/bin/make.exe" -f nbproject / Makefile-Release.mk   QMAKE = SUBPROJECTS = .build-conf make.exe [1]:输入目录   /c/Users/Orca/Documents/NetBeansProjects/Countdown timer' nbproject/Makefile-Release.mk:80: warning: overriding commands for target建立/释放/ MinGW的-视窗/ minute.o&#39;   nbproject / Makefile-Release.mk:75:警告:忽略旧命令   目标build/Release/MinGW-Windows/minute.o' nbproject/Makefile-Release.mk:90: warning: overriding commands for target build / Release / MinGW-Windows / second.o&#39;   nbproject / Makefile-Release.mk:85:警告:忽略旧命令   target build/Release/MinGW-Windows/second.o' "/C/MinGW/MSYS/1.0/bin/make.exe" -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/countdown_timer.exe make.exe[2]: Entering directory / c / Users / Orca / Documents / NetBeansProjects / Countdown timer&#39;   nbproject / Makefile-Release.mk:80:警告:覆盖命令   目标build/Release/MinGW-Windows/minute.o' nbproject/Makefile-Release.mk:75: warning: ignoring old commands for target build / Release / MinGW-Windows / minute.o&#39;   nbproject / Makefile-Release.mk:90:警告:覆盖命令   目标build/Release/MinGW-Windows/second.o' nbproject/Makefile-Release.mk:85: warning: ignoring old commands for target build / Release / MinGW-Windows / second.o&#39; mkdir -p   build / Release / MinGW-Windows rm -f   &#34;建立/释放/ MinGW的-视窗/ main.o.d&#34; g ++ -c -O2 -MMD -MP -MF   &#34;建立/释放/ MinGW的-视窗/ main.o.d&#34; -o   build / Release / MinGW-Windows / main.o main.cpp mkdir -p   build / Release / MinGW-Windows rm -f   &#34;建立/释放/ MinGW的-视窗/ minute.o.d&#34; g ++ -c -O2 -MMD -MP -MF   &#34;建立/释放/ MinGW的-视窗/ minute.o.d&#34; -o   build / Release / MinGW-Windows / minute.o minute.h mkdir -p   build / Release / MinGW-Windows rm -f   &#34;建立/释放/ MinGW的-视窗/ second.o.d&#34; g ++ -c -O2 -MMD -MP -MF   &#34;建立/释放/ MinGW的-视窗/ second.o.d&#34; -o   build / Release / MinGW-Windows / second.o second.h mkdir -p   dist / Release / MinGW-Windows g ++ -o   DIST /发行/ MinGW的窗口/ countdown_timer   建立/释放/ MinGW的窗口/ main.o   建立/释放/ MinGW的窗口/ minute.o   建立/释放/ MinGW的窗口/ minute.o   建立/释放/ MinGW的窗口/ second.o   建立/释放/ MinGW的窗口/ second.o   build / Release / MinGW-Windows / minute.o:文件无法识别:文件格式   无法识别collect2.exe:错误:ld返回1退出状态   make.exe [2]: * [dist / Release / MinGW-Windows / countdown_timer.exe]   错误1 make.exe [2]:离开目录   /c/Users/Orca/Documents/NetBeansProjects/Countdown timer' make.exe[1]: *** [.build-conf] Error 2 make.exe[1]: Leaving directory / c / Users / Orca / Documents / NetBeansProjects / Countdown timer&#39;的make.exe&#34 ;:   * [.build-impl]错误2

     

BUILD FAILED(退出值2,总时间:6s)

0 个答案:

没有答案