The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
A program to trace execution of another program jiten_hegde High Level Programming 3 08-19-2008 05:26 AM
multifile c program compilation and execution alokmishra8 UNIX for Dummies Questions & Answers 1 02-01-2008 05:05 AM
unix command for multifile program execution alokmishra8 Linux 0 02-01-2008 04:20 AM
help me do a small program!! THX lydragon Shell Programming and Scripting 1 09-10-2006 05:27 PM
small unix! nydel UNIX for Dummies Questions & Answers 4 05-22-2002 01:18 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-22-2007
bintaleb bintaleb is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 24
execution small C++ program in UNIX

Hi my friends

I am beginner unix programmer I have written small c++ program in text editor and I have change it mode to 555 to make it executable file to use it in unix O.P.

#include<iostream.h>

main()
{
cout<<"Hello World";
}

but some syntax erroe came for <<

can any one help me how can I make executable file to use it unix o.p.
  #2 (permalink)  
Old 09-22-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
You changed what to 555? Have you compiled this?

Code:
$ g++ c.cpp
In file included from /usr/include/c++/3.2.3/backward/iostream.h:31,
                 from c.cpp:1:
/usr/include/c++/3.2.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
  #3 (permalink)  
Old 09-24-2007
bintaleb bintaleb is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 24
execution small C++ program in UNIX

my brother

by this command you can change your file to many kind

chmod 555 {file name}
and I did not compile my program

can you tell me how can I compile my program?
  #4 (permalink)  
Old 09-24-2007
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Er, no. You cannot change your file's type. Your file still remains a text file with C++ source code which Unix cannot execute. You have to compile the file. In porter's post, the 'g++ c.cpp' command is compiling the file.

Is this your first C/C++ program on any OS? If you have written any programs before, you would know that you need to compile these before executing them.
  #5 (permalink)  
Old 09-24-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by bintaleb View Post
can you tell me how can I compile my program?
if the C++ compiler on your system is Gnu C++ then use

Code:
g++ c.cpp -o myprogram
and the executable will be in the file "myprogram", if you look at the file attributes you will notice the compiler (linker actually) has already made the file as an executable (+x).
  #6 (permalink)  
Old 09-26-2007
bintaleb bintaleb is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 24
Yes this is first program in OP because before I wrote my program in programming language with it compiler.

and my friends let me to try your idea and thanks so much for your help please stay with me
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0