Author Topic: auto-include of string library  (Read 3383 times)

ChickenCow

  • Guest
auto-include of string library
« 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.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: auto-include of string library
« Reply #1 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