[英]Eclipse: Automatic makefile generation not working?
在下图中的控制台中,您可以看到自动链接可能无法正常工作。 我需要做什么? 下面是我正在使用的代码。 我也做了刷新,清理和重建,但是错误仍然存在。
/*
* 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;
}
这不是链接器问题,而是编译器。 您需要在main.cpp
包含Fibonacci.h
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.