-
Problem z kompilacja....
Witam outz mam problem na linuxie.... jak kompiluje to mam taki error:
Kod:
squealer@linux-3qhy:~/Desktop> g++ lol.cpp -o lol
lol.cpp:1:23: warning: extra tokens at end of #include directive
In file included from /usr/include/c++/4.1.2/backward/iostream.h:31,
from lol.cpp:1:
/usr/include/c++/4.1.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
lol.cpp: In function ‘int main()’:
lol.cpp:6: error: ‘doube’ was not declared in this scope
lol.cpp:6: error: expected `;' before ‘przelicznik’
lol.cpp:11: error: ‘przelicznik’ was not declared in this scope
lol.cpp:15: error: expected primary-expression before ‘<<’ token
squealer@linux-3qhy:~/Desktop>
a to program
Kod:
#include <iostream.h>
int main ()
{
int stopy;
double metry;
doube przelicznik = 0.3;
std::cout << "podaj wysokosc w stopach: ";
std::cin >> stopy;
metry = stopy * przelicznik;
std::cout << "\n";
std::cout << stopy << "stop to jest: ";
<< metry << "metrow\n";
}
-
A więc tak, masz tam literówki:
Kod:
doube przelicznik = 0.3;
Nie doube tylko double.
Idąc dalej:
Kod:
std::cout << stopy << "stop to jest: ";
<< metry << "metrow\n";
Powinno być jak już:
Kod:
std::cout << stopy << stop to jest: " << metry << "metrow\n";
Chodzi o ten średnik który za wcześnie postawiłeś.
Poza tym, odpowiednie dla c++ jest:
a nie jak Ty zrobiłeś:
Kod:
#include <iostream.h>
Ech, cheers.
-
thx pomoglo ale i tak jakis error wyskoczyl ale sie zkompilowalo......
ale z tym:
Kod:
std::cout << stopy << "stop to jest: ";
<< metry << "metrow\n";
to tak mam w symfoni c++(ksiazce)