LinuxQuestions.org
Review your favorite Linux distribution.
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, 08:08 AM   #1
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 26

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, 01:52 PM   #2
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,035

Rep: Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336
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, 01:04 AM   #3
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 26

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, 01:22 AM   #4
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,035

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

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, 01:31 AM   #6
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,035

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

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, 01:55 AM   #8
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,035

Rep: Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336
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, 06:31 AM   #9
peacepanda
LQ Newbie
 
Registered: Oct 2012
Posts: 26

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, 07:33 AM   #10
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,035

Rep: Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336Reputation: 1336
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


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


All times are GMT -5. The time now is 06:26 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