Login Register






IDE For C/C++ Linux filter_list
Author
Message
RE: IDE For C/C++ Linux #11
(02-09-2014, 07:55 AM)Abhilash_26 Wrote: Yup!! i saved it ... but the actual problem is it is not recognizing conio...!! :Embarrassed:

conio.h is not available for *nix systems. It is an MS-DOS header.
You don't need it anyway. Use the standard libraries for IO and you can use them on every OS.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: IDE For C/C++ Linux #12
(02-09-2014, 10:00 AM)Deque Wrote:
(02-09-2014, 07:55 AM)Abhilash_26 Wrote: Yup!! i saved it ... but the actual problem is it is not recognizing conio...!! :Embarrassed:

conio.h is not available for *nix systems. It is an MS-DOS header.
You don't need it anyway. Use the standard libraries for IO and you can use them on every OS.

if i remove conio then....
Code:
include<iostream> void main() { clrscr(); cout<<"Hello C++"; getch(); }
then errors are
/home/abhilash_26/ccpp/Untitled2.cpp|2|error: ‘::main’ must return ‘int’|
/home/abhilash_26/ccpp/Untitled2.cpp||In function ‘int main()’:|
/home/abhilash_26/ccpp/Untitled2.cpp|4|error: ‘clrscr’ was not declared in this scope|
/home/abhilash_26/ccpp/Untitled2.cpp|5|error: ‘cout’ was not declared in this scope|
/home/abhilash_26/ccpp/Untitled2.cpp|5|note: suggested alternative:|
/usr/include/c++/4.7/iostream|62|note: ‘std::cout’|
/home/abhilash_26/ccpp/Untitled2.cpp|6|error: ‘getch’ was not declared in this scope|
||=== Build finished: 6 errors, 0 warnings ===|
i think it was better to add conio.... :Crazy: :Footinmouth: :Embarrassed:

Reply

RE: IDE For C/C++ Linux #13
(02-10-2014, 01:07 AM)Abhilash_26 Wrote:
(02-09-2014, 10:00 AM)Deque Wrote:
(02-09-2014, 07:55 AM)Abhilash_26 Wrote: Yup!! i saved it ... but the actual problem is it is not recognizing conio...!! :Embarrassed:

conio.h is not available for *nix systems. It is an MS-DOS header.
You don't need it anyway. Use the standard libraries for IO and you can use them on every OS.

if i remove conio then....
Code:
include<iostream> void main() { clrscr(); cout<<"Hello C++"; getch(); }
then errors are
/home/abhilash_26/ccpp/Untitled2.cpp|2|error: ‘::main’ must return ‘int’|
/home/abhilash_26/ccpp/Untitled2.cpp||In function ‘int main()’:|
/home/abhilash_26/ccpp/Untitled2.cpp|4|error: ‘clrscr’ was not declared in this scope|
/home/abhilash_26/ccpp/Untitled2.cpp|5|error: ‘cout’ was not declared in this scope|
/home/abhilash_26/ccpp/Untitled2.cpp|5|note: suggested alternative:|
/usr/include/c++/4.7/iostream|62|note: ‘std::cout’|
/home/abhilash_26/ccpp/Untitled2.cpp|6|error: ‘getch’ was not declared in this scope|
||=== Build finished: 6 errors, 0 warnings ===|
i think it was better to add conio.... :Crazy: :Footinmouth: :Embarrassed:

Do you want it to work on *nix or don't you?
It is always int main, not void main and you have to return either EXIT_FAILURE or EXIT_SUCCESS or 0.
void main is tolerated by some compilers, but it doesn't adhere the language standard.

To use cout put std:: in front of it (like the message says).

clrscr -- I suppose it is the clearscreen command for windows.
That's OS specific anyway. Get rid of it. At least if you want to develop for more platforms than one.

Instead of getch use getchar: http://www.cplusplus.com/reference/cstdi...kw=getchar
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: IDE For C/C++ Linux #14
In short you are programming in C89 and you must program in C99 or C++ (any standard)... Why don't you search for some books about programming C++ for Linux... Use Google :-)

Peace
[Image: wvBFmA5.png]

Reply

RE: IDE For C/C++ Linux #15
Thanks @Deque bro and @Ligeti bro .. for your support...
:Thumbs-Up:
actually i am writing too much c/c++ programs in Turbo C++ of windows.. so i am used to it..
but when switched to linux ... i was unable to run the same code...
That's why i created this post... :Smile:
i don't want to be spoonfed but will you help me in finding such a book which clarifies the differences in using the two.... i google but not found anything relevant... :embarrased:

Reply

RE: IDE For C/C++ Linux #16
So you already know C++, but you need to practice in Linux...

You could read: http://www.codefighter.com/linux1.html

And this (PDF): http://www.subdude-site.com/WebPages_Loc..._18pgs.pdf

I have a book, but not with me right now, I will check and come back to you asap.

Thanks
[Image: wvBFmA5.png]

Reply