LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Is there a C++ compiler in the FC6 distro that actually works? (https://www.linuxquestions.org/questions/programming-9/is-there-a-c-compiler-in-the-fc6-distro-that-actually-works-525599/)

fc6_user 02-04-2007 05:17 PM

Is there a C++ compiler in the FC6 distro that actually works?
 
I am relatively new to Linux and have just started learning my first programming language (C++). I'm trying to make my Linux machine my main machine but usually end up reverting to Windows because I can't get everything to work on Linux yet. I'm using Dev C++ published by Bloodshed on my Windows box, but I'd like to do my C++ on Linux. I've tried the various KDevelop programs in Applications -> Programming, however, cannot figure out how to get it to compile and run programs.

I've only been on Linux for a few weeks, so please, if you have a suggestion or an answer, keep it simple if you can (simple explanations or explicit commands for installations).

Thanks.

matthewg42 02-04-2007 06:06 PM

Don't confuse a compiler with an IDE. If I was more cynical, I might consider your post an attempt at trolling. The GNU C compiler (which also builds C++, fortran and many other languages) is a very capable piece of software
- arguably more capable than the compilers which ship from other vendors, particularly with respect to portability and standards compliance.

An IDE is not a compiler - you seem to be confusing the two.

If your require a fully featured IDE, kdevelop is worth a look, although I'd recommend using the very recently released version which you will probably have to build from source. Be aware this is still very much a work in progress. It is usable for many projects, but some features are not yet complete or comparable with other products.

Eclipse is another popular IDE for Linux, and has some very nice features. Eclipse is probably more frequently used for Java development then C++, but I believe it can be use for C++ with some success given a little effort in configuration.

Of course there are other options too. I'm sure you will get many suggestions in this thread.

The Dew 02-04-2007 07:00 PM

It would be nice if they made a IDE/Compiler like Visual C++(Windows) and XCode(Mac) for linux.

I have to admit, the IDE/Compilers on linux are crap in my case and aren't full blown like the above and I can see how these may help you in learning C++ but writing a full app must be hard because you can't manage your files.

I can see why many people don't make programs for linux, its because the range of tools for languages is limited in a way.

*Please, My views on things are different from most peoples, Do not Flame me for having my own opinion!*

tuxdev 02-04-2007 08:36 PM

Looks like you need to do some reading:
http://www.catb.org/~esr/writings/taoup/html/

graemef 02-04-2007 09:50 PM

Quote:

Originally Posted by The Dew
I have to admit, the IDE/Compilers on linux are c***

Have you actually used any, or was that just a mindless rant spewing forth?

Getting back to the original poster there are a number of IDE's that work with FC6 (which is what I have installed on my computer) At the moment I'm looking at Eclipse (whilst I'm not using it for C++ it does come with support for C++) Just uses your favourite package installer if you don't have it installed. Another very good IDE is KDevelop, I have used that for a lot of C++ development and it works very well. The other popular IDE that falls into the C++ category is Anjuta.

Of the three I'd recommend KDevelop.

As already mentioned these are IDEs the compiler is g++, which is as you might expect is integrated into the above mentioned IDE's. Happy coding.

Mega Man X 02-05-2007 12:52 AM

We actually have a sticky about IDE's right here (Does anyone actually read stickies?).

Saying that Linux does not have good IDE shows nothing but lack of knowledge. Assuming that a full feature IDE is good to "learn" a given language shows stupidity. IDE's are good to keep medium-large projects organized and to increase the programmer's productivity. If you are learning a language, you will be doing "Hello World" kind of programs and the last thing you need is a heavy IDE (thus you will need to learn how to use the IDE and the programming language itself).

And I'm not going to comment anything about confusing IDE with programming language...

graemef 02-05-2007 02:11 AM

Quote:

Originally Posted by Mega Man X
We actually have a sticky about IDE's right here

Thanks, I meant to mention that thread since it is more exhaustive than my brief comment.

carcassonne 02-05-2007 07:39 PM

Quote:

Originally Posted by The Dew
It would be nice if they made a IDE/Compiler like Visual C++(Windows) and XCode(Mac) for linux.

I have to admit, the IDE/Compilers on linux are crap in my case and aren't full blown like the above and I can see how these may help you in learning C++ but writing a full app must be hard because you can't manage your files.

*Please, My views on things are different from most peoples, Do not Flame me for having my own opinion!*

OK, so your opinion about KDevelop not being able to manage files and projects is exactly ... ?

And since you put 'IDE/Compilers' together, not really making a difference between them two, your opinion about gcc being c*** is exactly detailed with ... ?

Mega Man X 02-06-2007 01:12 AM

Quote:

Originally Posted by graemef
Thanks, I meant to mention that thread since it is more exhaustive than my brief comment.

No problems :). You know, I've many, many LQ.org links bookmarked. Since 50% of the questions here are the same (How to I install Linux, How do I remove Linux, How do I install Java, how do I compile C programs, How do I install programs in Linux... etc), I simply pick one of the bookmarked links and paste it here. Since the questions are the same, I don't need to create new answers ^_^;;.

matthewg42 02-06-2007 07:07 AM

Quote:

Originally Posted by Mega Man X
No problems :). You know, I've many, many LQ.org links bookmarked. Since 50% of the questions here are the same (How to I install Linux, How do I remove Linux, How do I install Java, how do I compile C programs, How do I install programs in Linux... etc), I simply pick one of the bookmarked links and paste it here. Since the questions are the same, I don't need to create new answers ^_^;;.

You do that too? :) We probably have some nice data to make a good FAQ.

Mega Man X 02-06-2007 10:07 AM

That is not a bad idea matthewg42 :). It would be good to have something like "Top 10 LQ questions" or something like that ;)

fc6_user 02-06-2007 02:36 PM

Hi there all! I didn't think a simple message would generate so much response. Wow! (Not sure if this is a good thing or not...)

Anyway, hey guys, don't forget, I'm the Linux newbie, I'm only doing 'Hello World!' and if, else, while and for stuff for the time being. I don't want to use Window$, I want to use that free OS whose source code is actually written in C++ (at least that's what I've been told!).

I need two pieces of information:

1) What extra things do I have to install in order to get my KDevelop C++ IDE or compiler (or any other one) working? (Please give me the exact commands, and perhaps this motion could be seconded by another of the above parties (lol)... I'm so afraid that things might go wrong!)

2) How do I actually compile and run a program in the KDevelop (or other) interface? I can't seem to find the right features in the menus.

Many thanks, I'm going to check out the above links and do some reading, but in the meantime, I'd like to get the f$*&#!@ thing working. It shouldn't be all [I]that[I]complicated!

Many thanks to all for all of the advice and comments!

P.S. - I was also told that it's possible to have a look at source code in Linux. I wouldn't mind actually having a look at the OS source code. How do you do this? Where is it? That would be so cool! (the kernel, or any other program source codes in C++)

graemef 02-06-2007 10:08 PM

I'll answer your question in two separate posts: first installing KDevelop:

KDevelop is part of fedora6. If you haven't got it installed then from the add remove software. From the browse list select the development group. From the packages select KDE software development, click optional packages and check that kdevelope is checked (I believe that it is by default). Click apply and it should install KDevelop and any dependencies.

graemef 02-06-2007 10:28 PM

Running KDevelop:
Under the Fedora Applications menu, you will have a Programming sub menu and under that there will be a KDevelop: C/C++ menu item, select that and KDevelop will start.
Select from the Project menu, New Project... the Create New Project dialog will be displayed. Expand the C++ folder (hint if that isn't displayed then click on the check box show all project templates) Select the Simple Hello World Program template. Give it a name (I'll choose hello) before you click next check the location, if you want it in a different place then you can change the location. This is the folder where the whole project will be stored. (Be aware that it does create a lot of files which is over kill for a small test project but don't worry) Now click the Next button.
This is the project options, select your license, name and email address and click the Next button.
Version Control, for now just click the Next button.
The template pages one for header files the other for code files (this is what will appear on the top of all new files) modify them if you want and then click the Next button (for each page).
Done, you have now set up a KDevelop project.
The basic code is very simple, but does it work?
Select the Build menu and Build Project F8, A dialog will appear telling you there is no make file, click the Run Them button. It will then run make and compile your project. Hopefully there will not be any errors.
You should see what is happening in a window at the bottom, if you don't see it them click the Messages tab in the bottom pane, here it will tell you that it is compiling hello.cpp, linking hello and finally *** Success ***.
Now run the project: Build menu Execute Program.... The program will then be run in a new console.

What's next? Modify the hello.cpp code, add new files (when you add a file it will add it to the project by default)

Best of luck.

PatrickNew 02-06-2007 10:42 PM

I think I interpreted his question differently, or perhaps I misunderstood it, but I kinda thought he was asking why we don't have IDE's with integrated GUI designers. I haven't written Visual* in a couple years, but from what I recall, writing a GUI was so easy, you didn't realize it wasn't a part of standard C/C++/BASIC/whatever.

I suppose, if that is what you meant, my answer would be that Linux doesn't have any one graphics toolkit. I suppose you could say XLib, but no one *wants* to code in XLib. However, check Anjuta, which sorta has one - it calls glade externally.


All times are GMT -5. The time now is 04:40 AM.