Sponsored Content
Top Forums Programming execution small C++ program in UNIX Post 302137261 by porter on Monday 24th of September 2007 04:21:16 AM
Old 09-24-2007
Quote:
Originally Posted by bintaleb
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).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help me do a small program!! THX

Write a shell script (to run on the Bourne shell) that runs an infinite loop to check every 5 seconds to report on who logs into and who logs out of a UNIX system. Without loss of practical significance of this little utility, we can ignore multiple logins from the same user during a time period of... (1 Reply)
Discussion started by: lydragon
1 Replies

2. Linux

unix command for multifile program execution

how can I compile and execute multifile program in unix os.:o (0 Replies)
Discussion started by: alokmishra8
0 Replies

3. Programming

A program to trace execution of another program

Hi, I wanted to know if i can write a program using switches and signals, etc to trace execution of other unix program which calls c program internally. If yes how? If not with signals and switches then are there any other methods apart from debugging with gdb/dbx. (3 Replies)
Discussion started by: jiten_hegde
3 Replies

4. UNIX for Dummies Questions & Answers

Small Program with variables

Hello Geniuses of the unix world. please help, stupid chemist. I have the following script that I need to create a file. Doesnt make sense unless i explain this way: I need to create a file called summary.in I would like all these lines to be inserted however in the command line I would like the... (1 Reply)
Discussion started by: gingburg
1 Replies

5. Programming

Debugging Program during execution

I have made use of 'valgrind' and -finstrument-functions compiler option for debugging / analyzing code. Both the options lets us know the line / file being executed to some extent. Is there a generic way that lets program dump the file:line it is getting executed dumped to a log file during... (3 Replies)
Discussion started by: uunniixx
3 Replies

6. Shell Programming and Scripting

main program is not calling small other programs

I am trying to understand a program in a book and this program suppose to call other programs which are in the same folder, the other programs are called 'lu' and 'add' but for some reason when it gets to the last line of each case to call these programs there is an error message saying ./rolo:... (2 Replies)
Discussion started by: bartsimpsong
2 Replies

7. Programming

Help with C++ program execution.

//Find the root of the equation (x^2)-2 by bisection method. #include<iostream> using namespace std; double a,x; double f(double x) { return ((x*x)-2); } //Suppose the function is (x*x)-2. void calcx(double a1,double b1) { x =... (2 Replies)
Discussion started by: poonam.gaigole
2 Replies

8. Shell Programming and Scripting

Execution of compressed program

I need UNIX scripts for polling, Uncompressing files and moving files between directory. Also trying to save file paths and any other variables in an independent file (.env) and use these at runtime by executing this file in the main script. (3 Replies)
Discussion started by: new2script
3 Replies

9. Homework & Coursework Questions

Small Grading Program

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1. Create a series of commands for a grading program. Create a grades file. Put a "tab" between the name and... (7 Replies)
Discussion started by: Jagst3r21
7 Replies

10. Shell Programming and Scripting

Making a bash script and small C program for a homework assignment

Here's the assignment. I'll bold the parts that are rough for me. Unfortunately, that's quite a bit lol. The syntax is, of course, where my issues lie, for the most part. I don't have a lot of programming experience at all :/. I'd post what I've already done, but I'm so lost I really don't know... (1 Reply)
Discussion started by: twk101
1 Replies
CERNLIB(1)						      General Commands Manual							CERNLIB(1)

NAME
cernlib - print CERN library dependencies SYNOPSIS
cernlib [options] libraries DESCRIPTION
cernlib is a tool to list the compiler and linker options necessary to compile a CERNLIB program that has the given library dependencies. It is generally used within a command substitution, as in the following example: gfortran -o myprogram myprogram.F `cernlib -G Motif pawlib` This version of cernlib has been completely rewritten from the original script provided by CERN. It now does recursive library dependency checking and removes duplicate entries. Note that by default, the cernlib script assumes that the CERN libraries are to be linked against statically; if the environment variables $CERN or $CERN_ROOT are specified, it looks for the libraries only in the "lib" subdirectory of those locations, not any "shlib" subdirec- tory. Furthermore, the script brackets the CERN libraries with linker instructions to link statically. This is done to preserve the orig- inal upstream behavior, in which all CERNLIB libraries exist only in static form. For instance, "cernlib packlib" outputs: -Wl,-static -lpacklib -lkernlib -Wl,-dy -lm -lnsl -lcrypt -ldl -lg2c If you want to link against ALL libraries (including CERNLIB) either statically or dynamically, call the cernlib script with its -safe flag to omit these bracketing linker flags. That is: if you want to link against all libraries (not just CERNLIB) statically, use the -static compiler flag and call cernlib with its -safe flag: gfortran -o myprogram myprogram.F -static `cernlib -safe -G Motif pawlib` and if you want to link against all libraries (including the CERN libraries) dynamically, use the same command without the -static compiler flag (the linker assumes dynamic linking by default): gfortran -o myprogram myprogram.F `cernlib -safe -G Motif pawlib` OPTIONS
-a arch Specify a system architecture, e.g. Linux (default), AIX, HP-UX, etc. -dy Equivalent to -safe; for backwards compatibility. -G driver Specify a graphics driver. The available options on Linux are X11 and Motif (the latter option will also work when the Lesstif library is present). -P, -s Ignored; for backwards compatibility. -safe Do not make any assumptions about whether the CERN libraries should be linked against dynamically or statically. (The default behavior, if this flag is not used, is to link them statically.) -u Do not include architecture-specific libraries in the output. -v version Specify version of $CERN_LEVEL. This is meaningless unless you have installed an upstream version of CERNLIB (i.e. not packaged by Debian); see the file /usr/share/doc/cernlib-base/README.Debian. -?, --help Show a summary of options. -- Tell cernlib that this marks the end of cernlib-specific flags, and all following arguments are to be parsed as described in the LIBRARIES section below. If -- is not given, the first word parsed as a library name will be the first word not starting with a hyphen "-" that is not an argument to a preceding cernlib flag. LIBRARIES
The following library names are recognized by this version of the cernlib script. These names may be used exactly as shown here, or pre- fixed by "-l". Core CERN libraries mathlib, packlib, kernlib Graphics and PAW libraries graflib, pawlib Monte Carlo and GEANT libraries cojets, eurodec, geant321, herwig59, isajet758, pdflib804, photos202, phtools Additional Monte Carlo libraries (to obtain these, see /usr/share/doc/montecarlo-base/README.Debian) ariadne, ariadne-p5, fritiof, jetset, lepto, pythia5, pythia6 Aliases The numerals at the end may be left off most of the library names above. Other library names Various other names are recognized for backwards compatibility, internal use, and non-Linux architectures. For the complete list, please see the cernlib script. Other Any names not recognized by cernlib that start with "-l" or with any character other than a hyphen ("-") are output as -l${name#-l} (i.e., are assumed to be a library). Names starting with a hyphen for which the second character is not "l" are assumed to be com- piler flags, and are output at the beginning of the line before all other output. SEE ALSO
/usr/share/doc/cernlib-base/README.Debian describes some of the changes that have been made to the CERN libraries in order to comply with Debian policy and the Filesystem Hierarchy Standard. CERNLIB documentation for all related libraries and programs is available at the following URL: http://cern.ch/cernlib/ AUTHOR
This manual page and the version of the cernlib script that it describes were written by Kevin McCarty <kmccarty@debian.org> for the Debian GNU/Linux system (but may be used by others). They are licensed under the GNU General Public License, version 2 or later (at your choice). COPYRIGHT
Copyright (C) Kevin B. McCarty, 2002, 2003, 2004, 2005, 2006. Jan 6, 2005 CERNLIB(1)
All times are GMT -4. The time now is 12:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy