News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

auto-include of string library

Started by ChickenCow, October 18, 2006, 05:21:47 PM

Previous topic - Next topic

ChickenCow


#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.

tiwag

no CodeBlocks doesn't anything AUTO***

try this
#include <iostream>

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


and this
#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