Eclipse:自动makefile生成不起作用?

时间:2014-04-02 22:29:44

标签: c++ eclipse makefile

在下图中的控制台中,您可以看到自动链接可能无法正常工作。我需要做什么?以下是我正在使用的代码。我也做了刷新,清理和重建,但错误仍然存​​在。

enter image description here

/*
 * Fibonacci.h
 *
 *  Created on: Apr 2, 2014
 *      Author: rose
 */

#ifndef FIBONACCI_H_
#define FIBONACCI_H_


unsigned int Fibonacci(unsigned int n);


#endif /* FIBONACCI_H_ */



/*
 * Fibonacci.cpp
 *
 *  Created on: Apr 2, 2014
 *      Author: rose
 */


#include "Fibonacci.h"

unsigned int Fibonacci(unsigned int n)
{
    if (n==1) {
        return 1;
    } else if (n == 0) {
        return 0;
    }

    return Fibonacci(n-2) + Fibonacci(n-1);
}



/*
 * main.cpp
 *
 *  Created on: Apr 2, 2014
 *      Author: rose
 */

#include <iostream>
#include "Fibonacci.h"

int main(int argc, char *argv[])
{
    std::cout << "Fibonacci(10) = " << Fibonacci(10) << std::endl;
}

1 个答案:

答案 0 :(得分:0)

这不是链接器问题,而是编译器。您需要在Fibonacci.h中加入main.cpp