C++ code compilation with gcc
|
2004-08-13, 02:13 PM,
ارسال : #1
|
|||
|
|||
C++ code compilation with gcc
[ltr]this simple code will be compiles and run easyle in VC++ but when it compiled with gcc, it gives u lots of errors, why????????
کد : #includeh <iostream> is there any difference in C++ codes bitween win and lin ??? i think this simple code should work with any verion of gcc or cc in any distr. of linux[/ltr] |
|||
2004-08-13, 03:28 PM,
ارسال : #2
|
|||
|
|||
[ltr]#includeh <iostream> void main(void) {cout<<"heeeeeeey"; }
how can i write left to write????????[/ltr] |
|||
2004-08-13, 11:30 PM,
ارسال : #3
|
|||
|
|||
دوست عزیز اگر دقیقا همین کد باشه که مشکل داره چون include در اول h ندارد!
To Follow The Path Look To The Master Follow The Master Walk With The Master See Through The Master Become The Master |
|||
2004-09-16, 04:44 PM,
ارسال : #4
|
|||
|
|||
whithat راست میگه. کد زیر رو امتحان کنید:
[ltr] #includeh <iostream.h> void main(void) { cout<<"heeeeeeey"; } [/ltr] و برای کمپایل [ltr] g++ -o main main.c [/ltr] |
|||
2004-09-17, 04:22 PM,
ارسال : #5
|
|||
|
|||
[ltr]
no !problrm is somewhere else i omitt DOT H because gcc told me. in the kdeveloper if u choose simple HELLO WORD program u can see the difference. everything is just like VC++ but a line which i cant remember but is som thin like this: using:: ........ i cant remember.sorry thanx for ur attention m8s [/ltr] m88 |
|||
2004-09-18, 12:53 AM,
ارسال : #6
|
|||
|
|||
سلام m88 حالا اینو امتحان کنید. یادتون باشه با g++ کمپایل کنید:
[ltr] #include <iostream> int main() { std::cout << "Hello GNU" << std::endl; return 0; } [/ltr] مقدار برگشتی main حتما باید int باشه. cout و cin هم جزئی از کلاس std هستند و مثل روش فوق باید استفاده بشن. تعجب نکنین gcc از لحاظ سازگاری با استانداردها حرف نداره و باید اصولی باهاش برنامه بنویسیم. یه کم سخته ولی به دردسرش می ارزه. |
|||
|