|
| madmaxsantana (44) | ||
| It's very basic and I am sure many guys will be able to help me out. I have been programming quite a bit in Windows with MSVC++ and Dev-C++.. I built simple programs for Windows Console and also did just a very little bit of Win32 Programming... Now I have changed my OS and I am working on Linux. I am absolutely new to programming in Linux with C++. I am using the built in compiler GNU-G++ most of you must have an idea of! I am starting off with simple console programme. Here is that program.
Now I have following questions... - In G++ whenever I include non-standard libraries like stdio.h or stdlib.h or even conio.h, it gives error that the library doesn't exist. Any ideas about downloading these libraries and inserting hem into the default include folder of G++??? - In the program above, please have a look at the comments at the beginning and end of program. Even if I use only standard libraries, how do I achieve my objectives that I have mentioned in the comments. - Finally, all the folks there, I would like to ask your help regarding the complier... Is there an IDE for C++ in linux which supports the simple console programming like above??? Because G++ is very tiresome, I edit my file, then compile and then if there is an error I again open the editor, again compile it and if there is an error again, huffff! Is there an IDE like MSVC++ in linux? I have tried KDevelop and Anjuta but they are for extensive KDE and Qt programming and I have no idea how to compile a simple console program in any of them... Please, any idea!??? | ||
| Bazzy (4120) | ||
| stdio.h is for C, for C++ include cstdio (the same for cstdlib ) Anyway, I can compile fine a program including stdio.h with g++, which version do you have? Which options are you compiling with? Regarding conio.h, NEVER use it! to clear the screen see: http://www.cplusplus.com/forum/articles/10515/
| ||
| madmaxsantana (44) | |
| Thanks a lot Bazzy! I once read that about cstdlib and cstdio... I simply had forgotten... it's been almost 6 months since i last did any programming in C++. And I don't know the version of my G++... How to find that out??? And OK. i won't use it. But may I know the reason? Some security malfunction? Thanks for that link about clearing the screen. And how to download Code::Blocks?\ Thanks again fella! | |
| madmaxsantana (44) | ||
In G++ if I am using
I have to link the library with -lcurses argument... I need a compiler which automatically links the libraries! | ||
| Bazzy (4120) | ||||
g++ -v | ||||
| madmaxsantana (44) | ||
| K... G++ Version
As clear from above output, I am using Ubuntu. Furthermore it is Ubuntu Jaunty Jackalope (9.04) And when I write C::B in my console, it returns "Command not found". That is how I search for the programs. I simply write the command. If it is available and installed, it runs the program. If it is available and not installed it returns "Program so and so is not currently installed. You can install it using apt-get bla bla..." If neither, it returns simple "Command not found..." So does that mean Code::Blocks isn't installed on my system and it is not available for my distro either??? And also how do I know which libraries of C++ are already installed in my system and which are standard ones. And where do i get new libraries... I am sorry if I am bothering you! But I have no other way of knowing all that! Consider it my limitation please and don't mind too much questioning by me. | ||
Last edited on | ||
| Bazzy (4120) | ||
It says to use apt-get only on common programs when it doesn't find one but codeblocks is in jaunty repositories:sudo apt-get install codeblocks
apt-cache search somelibrary it will show a lot of package, read those starting with 'lib'. If you find the wanted package you can install it: sudo apt-get install somelibrarypackagename. If you already have that library installed it will say "somelibrarypackagename is already the newest version"If you don't like the command line too much you can use synaptic. It is the same as APT but with a GUI showing you which packages you already have etc. You can find all the library header files in /usr/include Standard libraries are these: http://www.cplusplus.com/reference/ ( iostream, STL, string, C library, some few other ) [EDIT] g++ 4.3 is the second newest version (the same I use). If you want g++ 4.4 install gcc-snapshot | ||
Last edited on | ||
| madmaxsantana (44) | |
| Thanks a lot Bazzy! Will Codeblocks automatically link the libraries and is it a GUI package??? | |
| Bazzy (4120) | |||
If you are using some other library is not mush difficult to link to it, you just need to add the .so / .a files to the linker settings ( found in Build Options dialog )
| |||
| madmaxsantana (44) | |
| Grrrrrrrrrreaaaaaaaaaaaaaaaat Man!!! You are awesome... That was exactly what I needed! Thanks a lot again and again! | |
| madmaxsantana (44) | ||
| Just one niche pal! I don't know how to get libcurses.
I don't know whether it is installed in my system even. How can I link to it when I don't even know what is its name! | ||
Last edited on | ||
| Bazzy (4120) | |
| Try installing the packages libncurses5 and libncurses5-dev ( library files in /usr/lib : libncurses.a and libncurses.so ) | |
Last edited on | |
| computerquip (878) | |
| Linux distros normally give you a package managers to help download and install this. THe package probably looks like what Bazzy pointed out. If not, you can go to the site and manually add them in an orderly fashion to your header and library stockpiles in /usr/lib and /usr/include. | |
| ridowan007 (1) | |
| Look, as a new Linux programmer you could try this thread http://ubuntuforums.org/showthread.php?t=554070 Its a pretty good site for Linux newbie programmer. Also for using any library you have to install the main library package and the dev package(like libncurses5 is the library and libncurses5-dev is the dev package with headers). For linking libraries you have to set compiler option in your IDE(Like I use geany and thats "set includes and arguments" box I have added linking to all my daily using libraries). And as for conio.h thats a windows/dos only header. You cant use any of that but there is alternatives in Linux for all of that. Welcome for joining Linux World. :-) | |
This topic is archived - New replies not allowed.
