[oclug] gcc and the STL. Linking errors?

Bart Trojanowski bart-oclug at jukie.net
Fri Oct 11 14:05:02 EDT 2002


Since about 3-5 years ago the STD libraries started being defined under
the std namespace.  So you have to tell the compiler that you want to
use it.

* Mike Milner <milner at hotmail.com> [021011 12:03]:
> Hello,
> 
> I'm just getting into development on Linux.
> 
> I'm trying to make a small test project that uses the STL library and a 
> Makefile to build everything.
> 
> So, in my main file, test.cpp, I have the following:
> 
> #include <stdio.h>
> #include <string>

using namespace std;

> int
> main(){
>    string message;
>    message = "Hello World!\n";
> 
>    printf(message.c_str());
> 
>    return 0;
> }

Happy coding.

-- 
				WebSig: http://www.jukie.net/~bart/sig/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://tux.oclug.on.ca/pipermail/oclug/attachments/20021011/daec956a/attachment.bin


More information about the OCLUG mailing list