Hello. I am trying to run a c program on a unix shell (ssh). I have searched this forum but have not come accross the soultion to my problem, so I am posting my question here
I wrote the following simple code:
#include <iostream.h>
using namespace std;
int main()
{
cout << "\nThis is our first C++ prgram.";
cout << "\nIt works!!!";
return 0;
}
I saved this in a file called first.c
I entered command gcc first.c
I get error "first.c:1: iostream.h: No such file or directory"
I dont understand, does the gcc compiler not come with standard headers such as iostream and iomanip?
I'm not sure if this would solve your problem, but check your LD_LIBRARY_PATH. This would be different depending on your OS. It seem to me that your "env" variable may not include the system standard library path. Try > env|grep LIBRARY, then chek each directory to see if the library is there. You may just be missing the library in general. If on a linux platform try >locate ipstream.h. If you get a result then that mean you have some other problem.
Your shell has variables set (seen with the env command). One of them is the LD_LIBRARY_PATH. You need to find where the file iostream.h is located and add that directory path to your LD_LIBRARY_PATH.
(Ours is set up in a second profile)
# . /u/etc/profile
Profile Rev: v1.2.0.4 Platform: SunOS Architecture: sun4u
Initializing: ................ Done.
#
# echo $LD_LIBRARY_PATH
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib:/u/lib:/usr/ccs/lib:/usr/5bin/lib:/usr/ucblib:/usr/xpg4/lib:/u/lib:/usr/openwin/server/lib:/usr/openwin/lib:/usr/opt/SUNWmd/lib
So the OS is Debian Linux, not WinXP - the Linux system is where you are compiling, correct?
To find the file, you can ask the Sys Admin, or try using the find command (man find) - it may be in /usr or /u (it matters how the system is set up).
Yah I just found that browsing another site. THANX A LOT FOR HELP. I am finally seeing how c++, with unix, with a database tie in... its all coming together.
So my college degree wasnt a total waste, was it ?