LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (http://www.linuxquestions.org/questions/aix-43/)
-   -   Executing a c++ file in AIX (http://www.linuxquestions.org/questions/aix-43/executing-a-c-file-in-aix-4175444489/)

peacepanda 01-07-2013 07:08 AM

Executing a c++ file in AIX
 
Can someone help me with the instructions of compiling and executing a c++ file in AIX?

pan64 01-07-2013 12:52 PM

first step: what kind of compiler you have? http://www.unix.com/aix/106232-c-compiler-aix.html

peacepanda 01-08-2013 12:04 AM

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.

pan64 01-08-2013 12:22 AM

just type the name of it and press enter

peacepanda 01-08-2013 12:29 AM

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.

pan64 01-08-2013 12:31 AM

how did you compile test.cpp? (what is the command you executed?)

peacepanda 01-08-2013 12:50 AM

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

pan64 01-08-2013 12:55 AM

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

peacepanda 01-08-2013 05:31 AM

Thanks Pan64.I was able to execute the program.Are there any extensive documentation which tell me how to execute and run the programs.

pan64 01-08-2013 06:33 AM

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


All times are GMT -5. The time now is 03:15 AM.