Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have installed fedora on my system but i really dont have any idea how to write a C++ program in fedora and how to compile it .would anybody help regarding this.
You could, of course, use emacs or any other text editor . . even a GUI text editor like kwrite or gnotepad would work.
And I write this file:
Code:
#include<stdio.h>
int
main (void) {
printf("Hello, World!\n");
}
And then I can do this:
Code:
adam@hydra5:~$ gcc test.c -o test
adam@hydra5:~$ ./test
Hello, World!
adam@hydra5:~$
Of course, there are LOTS of options that you can pass to gcc, the GNU C Compiler . . . just do a 'man gcc' to see some of them, if not all.
If invoked as 'g++' instead of 'gcc' it will act as a C++ compiler. (You can also invoke it as just 'cc' or 'c++'.)
You don't have to operate purely in the command line like this. There are many development environments for X which are fully featured and have a lot of helpful tools. It is up to you to choose the one that you want. I don't know which is most popular these days, as I don't do a lot of coding.
Hi,
you might want to try codeblocks . It's Cross platform IDE for Linux, MacOS and Windows. Since I don't use Fedora, I'm not sure if they got it in there repository...
If not you can download it from there site.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
Rep:
Quote:
#include<stdio.h>
int
main (void) {
printf("Hello, World!\n");
}
WTF?
how about a code that looks, compiles and works normal?
Code:
#include <stdio.h>
int main(){
printf("Hello, World!\n");
return 0;
}
i compiled your code in turbo C++ and heres the messages
Code:
Compiling CH.C:
•Error CH.C 3: Declaration syntax error
•Error CH.C 3: ; Expected after "int"
•Warning CH.C 4: main(void) Declaration with no type, int assumed
•Warning CH.C 6: Function should return a value
i know that it is version 3.0 for dos dated 1992
i use Turbo C++ and GCC
and i make all my codes so it compiles for both
Umm, I really wouldn't. Why don't you use Eclipse CDT + MinGW or Cygwin for your windows development? Then at least you'd have an up to date C++ compiler that complies with the C++98 ISO standard
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
Rep:
Quote:
Originally Posted by gzunk
Umm, I really wouldn't. Why don't you use Eclipse CDT + MinGW or Cygwin for your windows development? Then at least you'd have an up to date C++ compiler that complies with the C++98 ISO standard
i use that too but some programs need to run on my dos 486 with 12 MB ram
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.