Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Unix (http://www.go4expert.com/forums/unix-forum/)
-   -   Compile and Execute c++ file under Unix (http://www.go4expert.com/forums/compile-execute-cpp-file-unix-t21661/)

Poonamol 5Apr2010 10:16

Compile and Execute c++ file under Unix
 
Hi,

I am using C++ under Unix environment.
I had created 2 files xyz.h and xyz.cpp, I want to compile them on unix server.
How can I do it? After compilation i need to execute it.

I created a simple hello world program and it work fine.
for compile i used cc x.cpp => then a.out file is generated
then i used ./a.out => it execute successfully.

But while I am compiling my own created files,
I am receiving following error
"The #include file xyz.h is not found"

But i kept my 2 files under same dir only. How can I solve this.
Thanks in advance....

jaydip 5Apr2010 12:38

Re: Compile and Execute c++ file under Unix
 
Quote:

Originally Posted by Poonamol (Post 66702)
Hi,

I am using C++ under Unix environment.
I had created 2 files xyz.h and xyz.cpp, I want to compile them on unix server.
How can I do it? After compilation i need to execute it.

I created a simple hello world program and it work fine.
for compile i used cc x.cpp => then a.out file is generated
then i used ./a.out => it execute successfully.

But while I am compiling my own created files,
I am receiving following error
"The #include file xyz.h is not found"

But i kept my 2 files under same dir only. How can I solve this.
Thanks in advance....

i want to know that u are create ur own header file or simply u write that #include xyz.h
or if u create ur header file then it must be stored in usr\include isn't it?

Poonamol 5Apr2010 13:35

Re: Compile and Execute c++ file under Unix
 
Hi,

I had created my own file called xyz.h and its already in "include" folder.
But header files included in xyz.h file are in diff location.
But i receive this error for all header files.

Please Help me out.

jaydip 5Apr2010 13:41

Re: Compile and Execute c++ file under Unix
 
Quote:

Originally Posted by Poonamol (Post 66708)
Hi,

I had created my own file called xyz.h and its already in "include" folder.
But header files included in xyz.h file are in diff location.
But i receive this error for all header files.

Please Help me out.


can u give me ur email id and i think u r now online so can we discussed on google chat becoz its easy for discussion rply fast

Poonamol 5Apr2010 13:45

Re: Compile and Execute c++ file under Unix
 
Hi,

Let me know your gmail id, I'll add u in my messanger.

jaydip 5Apr2010 13:52

Re: Compile and Execute c++ file under Unix
 
Quote:

Originally Posted by Poonamol (Post 66711)
Hi,

Let me know your gmail id, I'll add u in my messanger.

ok
my id is jay303frengy@gmail.com.

Poonamol 5Apr2010 14:15

Re: Compile and Execute c++ file under Unix
 
Hi,

I am using user define header files.
If I put header file and .cpp file under same location then it is giving error for header files which is included in my .h (xyz.h) file.

for example, xyz.h file content
#include "pqr.h"
#include"abc.h"
.
.
etc

header files of pqr.h and abc.h are giving error while compilation.

Please help me ASAP.


All times are GMT +5.5. The time now is 01:47.