Sinisterly
IDE For C/C++ Linux - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Computers (https://sinister.li/Forum-Computers)
+--- Forum: Operating Systems (https://sinister.li/Forum-Operating-Systems)
+--- Thread: IDE For C/C++ Linux (/Thread-IDE-For-C-C-Linux)

Pages: 1 2


RE: IDE For C/C++ Linux - Deque - 02-09-2014

(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.


RE: IDE For C/C++ Linux - Abhilash_26 - 02-10-2014

(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:


RE: IDE For C/C++ Linux - Deque - 02-10-2014

(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/cstdio/getchar/?kw=getchar


RE: IDE For C/C++ Linux - Ligeti - 02-10-2014

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


RE: IDE For C/C++ Linux - Abhilash_26 - 02-11-2014

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:


RE: IDE For C/C++ Linux - Ligeti - 02-11-2014

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_Local/RefInfo/Computer/Linux/LinuxGuidesOfOthers/linuxProgrammingGuides/pdfs/CPPprogramming/TutorialFor_CandCPP_ProgrammingOnLinux_2004_18pgs.pdf

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

Thanks