简体   繁体   English

Eclipse:自动生成文件无法正常工作?

[英]Eclipse: Automatic makefile generation not working?

In the console in the image below, you can see that automatic linking probably isn't working correctly. 在下图中的控制台中,您可以看到自动链接可能无法正常工作。 What do I need to do? 我需要做什么? Below is the code I'm using. 下面是我正在使用的代码。 I also did a refresh, clean, and rebuild, but the error remains. 我也做了刷新,清理和重建,但是错误仍然存​​在。

在此处输入图片说明

/*
 * 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;
}

It's not a linker problem, its the compiler. 这不是链接器问题,而是编译器。 You need to include Fibonacci.h in main.cpp . 您需要在main.cpp包含Fibonacci.h

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM