What might be causing this ?

This is a discussion on What might be causing this ? within the C++ Programming forums, part of the General Programming Boards category; 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 ...

  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,675
    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.
    I used to be an adventurer like you... then I took an arrow to the knee.

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, 02: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, 07:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21