RE: getting started help!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jack,

I'm not sure of any specific instructional book, but you can find books on UNIX development out there.  In particular, you might take a look at some of the books for development on Linux.  Much of what you find there concerning the compiler, Makefiles, etc., will also apply to you, even though you're working on Solaris.  You might also take a look at getting KDE running on your box and using the KDevelop IDE.  It's a nice place to start, if you're just learning the ropes.

Your problem below is due to the fact that the library libstdc++.so.5 is not in your LD_LIBRARY_PATH.  You probably have GCC installed somewhere other than /usr, so the library was not placed in /usr/lib, and hence is not in your default library search path.  What you need to do is add the path to the library to the LD_LIBRARY_PATH environment variable.  For example, if your GCC was installed in /usr/local, then you would need to add /usr/local/lib to LD_LIBRARY_PATH like this:

If you are using the Korn or Bash shell:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

If you are using the C shell:
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib

Once you do this, it should pick up the library and run.  Note that you'll have to use the correct path for your installation.

A couple other points that could be useful to you:

	The reason that it couldn't find the program when you simply typed a.out is because the current working directory is not in your path.  This is generally a good thing, but it can be added by simply adding "." to your PATH environment variable (similar to how it was done for LD_LIBRARY_PATH).

	1 (one) is considered and error exit status for programs on UNIX.  Generally, 0 (zero) is used to indicate success.  Any other return value indicates an error.  This is not always important, but is something that you need to keep in mind if you ever plan to test for the exit status of your program - especially when doing so in standard ways, such as with an if statement, etc.

Good luck!
Lyle

-----Original Message-----
From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx]On
Behalf Of Rutledge, Jack R Contractor OPM LIS
Sent: Monday, January 05, 2004 12:00 PM
To: 'gcc-help@xxxxxxxxxxx'
Subject: getting started help!


Hello, I am trying to find some help with the gcc 3.2.  I have written a
little c++ code before, but always inside of an IDE.  I am currently working
on a Solaris 9 x86 OS and do not have an IDE.  I have installed the gcc 3.2
version that came with the Solaris media kit.

Once everything was installed, I tried to simply test out the installation.
I wrote a simple little one liner program, and after many headaches, I
finally got it to compile.  The program is listed below.

Program name:  jr.cpp
#include <iostream>
int main (void)
{
  std::cout<<"It works!";
  return 1;
}

Once it compiled and created the a.out file, I tried to execute it.  I got
the following result.

I tried simply typing a.out, it says "a.out: not found"
I also tried ./a.out with a result of "ld.so.1: ./a.out: fatal:
libstdc++.so.5: open failed: No such file or directory killed"

I am unsure what it is that I am doing wrong, and would appreciate any help
that you might give me.  Also, is there any type of instructional book for
beginners using the gcc compiler collection?

thanks,


Jack R. Rutledge


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux