LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   No libraries, no packages... (http://www.linuxquestions.org/questions/linux-general-1/no-libraries-no-packages-497911/)

Tux-O-Matic 11-02-2006 11:26 AM

No libraries, no packages...
 
I tried to write a C++ program recently, but when I tried to compile it, the error message gave me an error telling me I didn't have the cstdio library. When I looked for it, I found it in, I think, the /usr/share/ directory (called gcc32).

I have a similar problem in Java with TerminalIO and other packages. I can't seem to make a reference to the packages.

I would really like some help. Now it seems like Perl is the only language that works the way I want it to.

rednuht 11-02-2006 01:09 PM

what commands are you using to build the C++ and java projects ?
(more information the better)

Tux-O-Matic 11-02-2006 03:09 PM

I type the following:
Quote:

gcc foo.cpp
Where foo is the name of the file.
I got a long, complicated string that basically said it couldn't find the libraries.
When that didn't work, I tried the other method:
Quote:

chmod 777 foo.cpp
./foo.cpp
Then, I recieved more of a specific error message, saying it couldn't find the libraries.

Java generally did the same thing.
Quote:

javac foo.java
java foo
Please note, that with Java, I was able to get an output, and even though I have the packages for input (TerminalIO), I could not get the compiler to recognize TerminalIO or any other package.

timmeke 11-03-2006 09:36 AM

Is your environment set up correctly?
ie for dynamic libraries, you'll want to have $LD_LIBRARY_PATH set correctly.

And please post:
1. your c++/java code;
2. the exact error messages

EDIT: for Java, you may need $CLASSPATH and/or $JAVA_HOME for instance.

Tux-O-Matic 11-27-2006 05:13 PM

Sorry it took so long to get back...
Here's the C++ Code:
Quote:

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace;
int main (int nNumberOfArgs, char* pszArgs[])
{
cout << "Hello World!\n";
system ("PAUSE");
return 0;
}
Here's what I typed:
Quote:

gcc HelloWorld.cpp
Oops...I don't know what happed to the file with the debuggin info. It basically said cstdio and iostream couldn't be found, and also that using wasn't a valid command.

timmeke 11-28-2006 02:36 AM

1. Try compiling it with g++ instead of gcc. This shouldn't make much difference, but try it anyway.
2. If you want to use the default "std" namespace, you should omit the "using namespace;" line or put
"using namespace std".
3. Clearly, your compiler can't locate your C++ libraries. Can you please post the output of
echo $LD_LIBRARY_PATH
echo $PATH
whereis libstdc++


All times are GMT -5. The time now is 01:13 AM.