Thread: What might be causing this ?

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    London
    Posts
    14

    What might be causing this ?

    I've got this code:
    Code:
    #include "stdafx.h"
    #include <bitset>
    
    void someFunction(std::string str){
         std::bitset<8> firstChar[str[0]);
    }
    Everything compiles correctly here. When I change order of includes it won't compile any more. What could possibly cause it ?

    Code:
    #include <bitset>
    #include "stdafx.h"
    
    void someFunction(std::string str){
          std::bitset<8> firstChar[str[0]);
    }
    error C2039: 'bitset' : is not a member of 'std'

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    That's a problem with using precompiled headers in a project I think(?). The "stdafx.h" one must always come first I believe. It's one reason I don't like using them in my projects, order of header includes should not affect compilation.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is causing WM_PAINT to be sent?
    By DL1 in forum Windows Programming
    Replies: 8
    Last Post: 10-08-2009, 10:12 PM
  2. strlen causing my program to freeze
    By Beowolf in forum C Programming
    Replies: 2
    Last Post: 09-11-2007, 04:09 PM
  3. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  4. Computer differences causing error?
    By conright in forum Windows Programming
    Replies: 9
    Last Post: 01-06-2003, 03:48 PM
  5. what is causing this seemingly simple app to crash?
    By Shadow12345 in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2002, 08:36 PM