LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 01-07-2013, 07:08 AM   #1
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 27

Rep: Reputation: Disabled
Question Executing a c++ file in AIX


Can someone help me with the instructions of compiling and executing a c++ file in AIX?
 
Old 01-07-2013, 12:52 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
first step: what kind of compiler you have? http://www.unix.com/aix/106232-c-compiler-aix.html
 
1 members found this post helpful.
Old 01-08-2013, 12:04 AM   #3
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 27

Original Poster
Rep: Reputation: Disabled
Question Compiler being used...

Hi Pan64 the compiler that I am using is xlC.I have got my file compiled but I am not sure how to execute the file.
 
Old 01-08-2013, 12:22 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
just type the name of it and press enter
 
Old 01-08-2013, 12:29 AM   #5
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 27

Original Poster
Rep: Reputation: Disabled
Question Unable to execute the file

Hi Pan64.My cpp file name is test.cpp and my abject file name is test.o.Now what should be my command to execute the file.Because when I run any of these commands I get the error as

test.o
test.o: Command not found.
my_server 27% test.cpp
test.cpp: Command not found.
my_server 28% test
my_server 29% test.o
test.o: Command not found.
my_server 30% ./test
./test: Command not found.
 
Old 01-08-2013, 12:31 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
how did you compile test.cpp? (what is the command you executed?)
 
Old 01-08-2013, 12:50 AM   #7
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 27

Original Poster
Rep: Reputation: Disabled
Question

This is the command that I have used

xlC_r -I/usr/lpp/cics/include -I/usr/lpp/cics/include/icc -c -o test.o test.cpp
 
Old 01-08-2013, 12:55 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
try:
xlC_r -I/usr/lpp/cics/include -I/usr/lpp/cics/include/icc -o test test.cpp
you can exexute test by typing: ./test
 
Old 01-08-2013, 05:31 AM   #9
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 27

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thanks Pan64.I was able to execute the program.Are there any extensive documentation which tell me how to execute and run the programs.
 
Old 01-08-2013, 06:33 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
yes, the manual of the compiler: how to compile and generate an executable, especially you need to take care about the flags. (what does -c, -o and the others mean), the manual of the linker: how ld works.
see this book: http://publib.boulder.ibm.com/infoce...pilingpgms.htm
 
  


Reply

Tags
aix, cpp



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
[SOLVED] Executing a .run file macy Linux - Newbie 19 04-06-2012 02:10 PM
Executing a file in wine uphu Linux - Games 3 12-10-2004 04:18 PM
Making VSAM file from a flat file in AIX Raghothaman AIX 2 08-25-2004 04:55 PM
executing file dontknowshit Mandriva 2 06-10-2004 08:28 PM
executing a file pantera Programming 1 05-25-2004 01:06 AM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 10:28 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration