Help with C++ in Linux
Hi pple,
I have 3 questions re writing C++ programs in Linux. 1) Is there any help section about the C++ headers and functions available in g++ that i can refer to? I want to find out what header files contain which functions..for example outportb() in dos.h writes data to a port in Windows but the function becomes outb() in Linux and under a different header..how can i search under which header file this function falls in? Is there any help menu for g++? the man command only gives me help on linux commands 2) I tried writing my 1st C++ program in Linux but it didn't compile...until i found that i have to write #include <iostream> without the .h but as it is some1 gave me a C++ program in Lunix to me and in that program all headers have .h so how come i got a warning stating that iostream.h was deprecated? 3) I also found out that cout << doesn't work until i have \n at the end like cout << " Hi \n"; ...why is it this way? pls your help guys....i new to Linux..am using RedHAT 8.0 Thanks Bondfire |
TO SOLVE ALL THE PROBLEM: I suggest you switch to use some IDE such as kdevelop.
1) To find out a list of function available in a .h file, just open this file to have a look. For example if you open cmath.h, you can see that abs and sqrt function available in this file. 2) Switch to an IDE to deal with this problem 3) cout << must end with a line craft character, \n or <<endl. |
Re: Help with C++ in Linux
Quote:
Quote:
Quote:
|
here is a good recource for the functions included in the standard header files and what they do. gcc compiles standard c++, so as long as you use standard functions it should compile. i have never used and IDE, i prefer to program with textfiles and vi.
i don't know why cout wont work for you unless you use a \n. it does not have to have a \n at the end to work. if you leave off the new line character you just get your new command propt on the same line as the last line of your programs output. although, you do know that cout is in the std namespace and has to refered to as std::cout unless you use the use namespace std; at the top of your program right? |
All times are GMT -5. The time now is 09:32 PM. |