LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-23-2012, 03:13 PM   #1
Nbiser
Member
 
Registered: Oct 2012
Location: Maryland
Distribution: Fedora, Slackware, Debian, Ubuntu, Knoppix, Helix,
Posts: 284
Blog Entries: 7

Rep: Reputation: 43
Question How do I get a C++ program to run?


I am new to programming and working with KDevelop. I wrote a hello world program and tried to g++ in the terminal section of the KDevelop. But it doesn't do anything, it just sits, spins it wheels for a second....and that's all. Is there anything I'm doing wrong? I can give a screenshot if you need it.
 
Old 11-23-2012, 03:31 PM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 778
Blog Entries: 2

Rep: Reputation: 199Reputation: 199
Has a new file been created when you do the g++ thing? For instance if it's called a.out can you run it by doing ./a.out ?
 
1 members found this post helpful.
Old 11-23-2012, 03:38 PM   #3
Nbiser
Member
 
Registered: Oct 2012
Location: Maryland
Distribution: Fedora, Slackware, Debian, Ubuntu, Knoppix, Helix,
Posts: 284
Blog Entries: 7

Original Poster
Rep: Reputation: 43
Talking Problem Solved!

Quote:
Originally Posted by linosaurusroot View Post
Has a new file been created when you do the g++ thing? For instance if it's called a.out can you run it by doing ./a.out ?
Problem Solved! Thanks!
 
Old 11-24-2012, 08:58 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
I would add to linosaurusroot's comment, a couple of things:
  1. No news is good news when compiling. If you don't see any messages, everything is right.
  2. The default name of the executable is 'a.out'. You can specify a meaningful name by using the '-o' option.
    Code:
    g++ -o myExecutable mySourceFile.c
--- rod.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help Trying to open or run a file/program through a c++ program xskycamefalling Programming 4 01-19-2010 02:26 PM
Need help Trying to open or run a file/program through a c++ program xskycamefalling Programming 2 01-18-2010 02:51 PM
Simple C++ Program: Program Compiles But Won't Run (Segmentation Fault) violagirl23 Programming 3 01-09-2008 12:09 AM
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 08:19 AM


All times are GMT -5. The time now is 05:37 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration