-   AIX (
-   -   Executing a c++ file in AIX (

peacepanda 01-07-2013 08: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 01:52 PM

first step: what kind of compiler you have?

peacepanda 01-08-2013 01: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 01:22 AM

just type the name of it and press enter

peacepanda 01-08-2013 01: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: 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 01:31 AM

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

peacepanda 01-08-2013 01: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 01:55 AM

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 06: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 07: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:

All times are GMT -5. The time now is 11:54 AM.