• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Miss #include <vector>
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Miss #include <vector>


  • Subject: Re: Miss #include <vector>
  • From: Lorenzo <email@hidden>
  • Date: Wed, 22 Mar 2006 10:27:44 +0100

Exactly. In my FileA.m I call

    #include "FileB.h"

and in the FileB.h there is a call

    #include <vector>

So I get the error: vector: No such file or directory
The FileB.h header is associated to the FileB.cc, so in a different
environment it worked. The problem comes when I want to include this C++
routines into my code.

I tried to tell the compiler to "Compile Sources As" Objective-c++
but I got a bunch of other different errors. So I would like to find a
better solution. Any idea?


Best Regards
--
Lorenzo
email: email@hidden

> From: Rush Manbert <email@hidden>
> Date: Tue, 21 Mar 2006 14:46:23 -0800
> To: Nick Zitzmann <email@hidden>
> Cc: Lorenzo <email@hidden>, email@hidden
> Subject: Re: Miss #include <vector>
>
> Nick Zitzmann wrote:
>>
>> On Mar 21, 2006, at 2:45 PM, Lorenzo wrote:
>>
>>> My compiler says "error: vector: No such file or directory"
>>> on the line:
>>>
>>>     #include <vector>
>>>
>>> What should I include/link in order to get it to run?
>>
>>
>> What is the extension of the source file? That ought to just work if
>> the file has a .cpp or .mm extension.
>>
>
> Funny, this is also being discussed on the Xcode list. Because of that,
> I can say that you can also see this if you compile file.m, which is
> pure objective-c, but somewhere in its import chain, a header file is
> included that includes <vector>, something like this:
>
>
>        imports        imports        includes
> FileA.m ------->FileB.h------->FileC.h--------> <vector>
> Obj-C           Obj-C         Obj-C++           C++
>
> The compile on FileA.m will fail with the error described in the initial
> post.
>
> It seems that you could probably put conditionals into FileC.h that
> protect the compiler from seeing the <vector> include, but that probably
> opens up a whole can of worms with the FileC public interface. It seems
> to me that the best thing to do in this case is to change your build
> settings and tell the compiler to "Compile Sources As" Objective-c++. I
> haven't seen anything bad happen from doing this, and it makes mixed
> Obj-C/C++ development a lot easier.
>
> Is there any reason to avoid this solution?
>
> - Rush

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Miss #include <vector> (From: Rush Manbert <email@hidden>)

  • Prev by Date: Getting float bitmap data to and from CIImage
  • Next by Date: Develop for many platforms
  • Previous by thread: Re: Miss #include <vector>
  • Next by thread: Re: Miss #include <vector>
  • Index(es):
    • Date
    • Thread