C++ ile yazilmis basit bir iki programi derlerken derleme hatalari ile
karsilastim. Dusunceme gore gcc'ye eksik parametre girdim. Acaba C++ ile
yazilmis kodu gcc ile derlerken hangi secenekleri kullanmaliyim?
Herkese kolay gelsin.
Saygi, sevgi, LinuX.
----------------------------------------------------------
Birinci Dosya: (Klasik baslama programi:)
#include <iostream.h>
#include <iomanip.h>
main (){
cout << "Hello!;
}
Komut satiri: gcc hello.cc -o hello
HATA MESAJI:
hello.cc:4: unterminated string or character constant
hello.cc:4: possible real start of unterminated constant
---------------------------------------------------------------
Ikinci Dosya:
#include <iostream.h>
#include <iomanip.h>
main (){
float temp;
cout << "Please type the temprature (deg F): ";
cin >> temp;
cout << temp;
cout << "Deg F is";
cout << (5.0 * (temp - 32)) / 9.0;
cout << "deg C";
}
Komut satiri yine ayni
HATA MESAJI:
/tmp/cca007571.o: In function `main':
/tmp/cca007571.o(.text+0xc): undefined reference to `cout'
/tmp/cca007571.o(.text+0x11): undefined reference to
`ostream::operator<<(char const *)'
/tmp/cca007571.o(.text+0x1f): undefined reference to `cin'
/tmp/cca007571.o(.text+0x24): undefined reference to
`istream::operator>>(float&)'
/tmp/cca007571.o(.text+0x31): undefined reference to `cout'
/tmp/cca007571.o(.text+0x36): undefined reference to
`ostream::operator<<(float)'
/tmp/cca007571.o(.text+0x45): undefined reference to `cout'
/tmp/cca007571.o(.text+0x4a): undefined reference to
`ostream::operator<<(char const *)'
/tmp/cca007571.o(.text+0x75): undefined reference to `cout'
/tmp/cca007571.o(.text+0x7a): undefined reference to
`ostream::operator<<(double)'
/tmp/cca007571.o(.text+0x89): undefined reference to `cout'
/tmp/cca007571.o(.text+0x8e): undefined reference to
`ostream::operator<<(char const *)'
--------------------------------------
| Osman Demirhan |
| Kocaeli Universitesi |
| Elektronik ve Haberlesme Muh. Bol. |
--------------------------------------