locked
C++ #include <array> RRS feed

  • Question

  • Hi,

    I'm running into a problem compiling a very simple line of code, namely

    #include <array>

    I found exactly this line of code at http://msdn.microsoft.com/en-us/library, but I keep getting an error message

    fatal error 1083:  Cannot open include file: 'array': No such file or directory

    Any help would be appreciated.

    Thanks,

    Paul

    Wednesday, January 27, 2010 11:26 PM

Answers

  • Make sure you have VS2008 with SP1 AND the Feature Pack installed.  If you don't you won't have array.
    • Proposed as answer by Nikita Leontiev Thursday, January 28, 2010 6:35 PM
    • Marked as answer by Wesley Yao Friday, January 29, 2010 4:50 AM
    Thursday, January 28, 2010 12:10 AM

All replies

  • What is array? And why you are trying to include it as header?
    Wednesday, January 27, 2010 11:33 PM
  • Make sure you have VS2008 with SP1 AND the Feature Pack installed.  If you don't you won't have array.
    • Proposed as answer by Nikita Leontiev Thursday, January 28, 2010 6:35 PM
    • Marked as answer by Wesley Yao Friday, January 29, 2010 4:50 AM
    Thursday, January 28, 2010 12:10 AM
  • Simon, can you please give me a link, where I can read about this array.
    Thursday, January 28, 2010 8:50 AM
  • Nikita Leontiev wrote:
    > Simon, can you please give me a link, where I can read about this array.
     

    --
    Igor Tandetnik
    Thursday, January 28, 2010 3:20 PM
  • Thank you, Igor. New information for me today.
    Thursday, January 28, 2010 4:13 PM
  • Thanks SimonRev, that sounds like what I need.

    On the msdn webpage they just have #include <array> so I wanted to see if I cout get that to work. 
    I'm actually trying to compile an inherited code that has #include <tr1/array>.  The inherited code is a few years old.
    I gather that <array> is TR1.  Do I need #include <array> or #include <tr1/array>?

    Thanks  

    Paul

    Thursday, January 28, 2010 5:29 PM
  • #include <array> is fine.  If you look at your VC include directory you will see array sitting there and not in any sub directory.
    Thursday, January 28, 2010 6:11 PM
  • Simon,

    Thanks again!!

    Paul 
    Thursday, January 28, 2010 6:34 PM
  • VC9 SP1 supersedes the Feature Pack, which shouldn't be installed anymore. See http://blogs.msdn.com/vcblog/archive/2008/08/11/tr1-fixes-in-vc9-sp1.aspx for a list of fixes.

    Thursday, January 28, 2010 9:58 PM
  • Stephen,

    So are you saying that I just need to install Service Pack VC9 SP1 and the compiler will recognize #include <array>?

    Paul
    Friday, January 29, 2010 4:48 PM
  • Yes.
    Friday, January 29, 2010 5:23 PM
  • VS 2008 was initially released without the TR1 extensions.  They were later released as part of the Feature Pack which was later superceded by the Service Pack (Thanks STL for clearing that up for me, I wasn't sure which came first).

    Friday, January 29, 2010 10:03 PM