PDA

View Full Version : g++ questions


LackeyLad
2004-06-12, 08:31 PM CDT
1. Does anyone know of a site where i can research why i get the -Wno deprecated messege on my g++? Something about not needed to add the .h precompiler libraries.

2. Also, i cant seem to compile anything that uses the # include <string> library. Why does that not compile with fedora g++?

ghaefb
2004-06-12, 08:39 PM CDT
Maybe you forgot to write this line:

using namespace std;

And you wrote #include <string> right? (not # include <string>)

micha
2004-06-12, 08:40 PM CDT
1. What is the error you get? Look at the gcc manual on the gcc web site, you might find some useful information. http://gcc.gnu.org

2. The C++ Standard Library (including <string>) works well for me. Make sure that everything related to gcc and C++ library is installed.

--Micha

LackeyLad
2004-06-12, 08:45 PM CDT
does the space between the # and include matter?

Ug
2004-06-12, 08:53 PM CDT
Yes it does, your code should look like this: #include <string.h>

micha
2004-06-12, 09:01 PM CDT
Or if you use C++ Standard Library:#include <string>
std::string my_string;
You don't need the .h extension for the C++ standard library. There is a "bridge" for the inclusion of C standard library in standard C++:
#include <cstdlib>
#include <cmath>
...

--Micha

theurge
2004-06-16, 11:29 AM CDT
This also works:


#include <string>
using std::string;


That way you don't have the increased overhead with "using namespace std" and you don't have to scope every single string you create.