Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
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.
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++
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.