Compilen klappt nicht
-
Hallo zusammen,
also ich habe folgenden source code - so von der ETHZ bereitgestellt:
// Program: sum_n.C
// Compute the sum of the first n natural numbers.#include <iostream>
int main()
{
// input
std::cout << "Compute the sum 1+...+n for n =? ";
unsigned int n;
std::cin >> n;// computation of sum_{i=1}^n i
unsigned int s = 0;
for (unsigned int i = 1; i <= n; ++i) s += i;// output
std::cout << "1+...+" << n << " = " << s << ".\n";
return 0;
}Ich arbeite und Windows XP mit Cygwin. Wenn ich also den Emacs starte und diese Source zu kompilieren (g++ compiler) versuche kommt folgendes:
cd /home/Administrator/ifm/source/
make -k sum
make: *** No rule to make target `Scope'.Compilation exited abnormally with code 2 at Wed Oct 17 23:02:12
Dasselbe geschieht auch bei folgendem source-Code:
// Program: collatz.C
// Compute the Collatz sequence of a number n.#include <iostream>
int main()
{
// Input
std::cout << "Compute the Collatz sequence for n =? ";
unsigned int n;
std::cin >> n;// Iteration
while (n > 1) {
if (n % 2 == 0)
n = n / 2;
else
n = 3 * n + 1;
std::cout << n << " ";
}
std::cout << "\n";
return 0;
}Ich weiss, dass Mitstudenten von mir denselben sourcecode mit Emacs und g++ compiliren können, weiss jemand, wieso es bei mir nicht klappt, denn sonst klappt es stehts!
Lg Alex
-
Hat nichts mit dem Code zu tun, scheinbar ist das Makefile falsch, oder make wird falsch aufgerufen (evtl. "make -k sum**_n**"?)