Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ChickenCow on October 18, 2006, 05:21:47 pm

Title: auto-include of string library
Post by: ChickenCow on October 18, 2006, 05:21:47 pm
Code
#include <iostream>
using namespace std;

int main(){
   string s1 = "C::B is the best.";
   cout << s1 << endl;
   return 0;
}

This results in no compiler errors even though I have not explicitly included the string library.  Is this inherent to GCC or is this something that C::B is doing?  I looked through the compiler options, but I didn't see anything about auto-including libraries.  I did not, however, peruse the compiler/linker switches because I am not terribly familiar with them.

Is there a way I can enforce stricter checking to ensure that the library must be included (mostly for compiler compatability on another IDE)?

Thanks.
Title: Re: auto-include of string library
Post by: tiwag on October 18, 2006, 05:45:14 pm
no CodeBlocks doesn't anything AUTO***

try this
Code
#include <iostream>

int main(){
   string s1 = "C::B is the best.";
   std::cout << s1 << std::endl;
   return 0;
}

and this
Code
#include <iostream>

int main(){
   std::string s1 = "C::B is the best.";
   std::cout << s1 << std::endl;
   return 0;
}

then you'll find the answer  :P