Windows CE and sys/types.h

2,098 views
Skip to first unread message

gordoncww

unread,
Jul 7, 2008, 7:39:45 PM7/7/08
to Google C++ Testing Framework
I'm trying to compile the google test libraries for use in a windows
ce app. It seems several of the .h files include sys/types which is
not available under for CE. Is there a workaround for this?

Thanks in advance.

Zhanyong Wan (λx.x x)

unread,
Jul 7, 2008, 7:58:12 PM7/7/08
to gordoncww, Google C++ Testing Framework
Hi, Gordon (?),

Our initial release only supports building on Linux so there may be
glitches on other platforms. We are working on getting the build
support for other system ready.

I don't have the Windows CE environment at hand, so I cannot readily
investigate the problem you reported. If I remember correctly, we
included sys/types.h for the definition of type size_t. Could you try
to replace that #include with whatever header that defines size_t on
CE? Let me know if that works. Thanks!

--
Zhanyong

Chandler Carruth

unread,
Jul 7, 2008, 8:30:25 PM7/7/08
to Zhanyong Wan (λx.x x), gordoncww, Google C++ Testing Framework

Ahh, this is the culprit. <sys/types.h> isn't the correct header for
size_t. size_t is a C standard type, while <sys/types.h> is a POSIX
standard header. I believe the correct header is <stddef.h>, but I
don't have the standard here, so I'll have to double check that.

-Chandler

>
> --
> Zhanyong
> _______________________________________________
> opensource-gtest mailing list
> opensour...@google.com
> https://mailman.corp.google.com/mailman/listinfo/opensource-gtest
>

Zhanyong Wan (λx.x x)

unread,
Jul 8, 2008, 2:14:07 AM7/8/08
to Chandler Carruth, gordoncww, Google C++ Testing Framework
On Mon, Jul 7, 2008 at 5:30 PM, Chandler Carruth <chan...@google.com> wrote:
> On Mon, Jul 7, 2008 at 4:58 PM, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
>>
>> Hi, Gordon (?),
>>
>> On Mon, Jul 7, 2008 at 4:39 PM, gordoncww <gord...@gmail.com> wrote:
>>>
>>> I'm trying to compile the google test libraries for use in a windows
>>> ce app. It seems several of the .h files include sys/types which is
>>> not available under for CE. Is there a workaround for this?
>>>
>>> Thanks in advance.
>>
>> Our initial release only supports building on Linux so there may be
>> glitches on other platforms. We are working on getting the build
>> support for other system ready.
>>
>> I don't have the Windows CE environment at hand, so I cannot readily
>> investigate the problem you reported. If I remember correctly, we
>> included sys/types.h for the definition of type size_t. Could you try
>> to replace that #include with whatever header that defines size_t on
>> CE? Let me know if that works. Thanks!
>
> Ahh, this is the culprit. <sys/types.h> isn't the correct header for
> size_t. size_t is a C standard type, while <sys/types.h> is a POSIX
> standard header. I believe the correct header is <stddef.h>, but I
> don't have the standard here, so I'll have to double check that.

Good point. Wikipedia says size_t is defined in stdlib.h.

Gordon, could you remove the first "#include <sys/types.h>" in
include/gtest/internal/gtest-port.h and see if it works? Thanks,

>
> -Chandler
>
>>
>> --
>> Zhanyong
>> _______________________________________________
>> opensource-gtest mailing list
>> opensour...@google.com
>> https://mailman.corp.google.com/mailman/listinfo/opensource-gtest
>>
>

--
Zhanyong

Chandler Carruth

unread,
Jul 8, 2008, 2:36:18 AM7/8/08
to Zhanyong Wan (λx.x x), gordoncww, Google C++ Testing Framework
On Mon, Jul 7, 2008 at 11:14 PM, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
> On Mon, Jul 7, 2008 at 5:30 PM, Chandler Carruth <chan...@google.com> wrote:
>> On Mon, Jul 7, 2008 at 4:58 PM, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
>>>
>>> Hi, Gordon (?),
>>>
>>> On Mon, Jul 7, 2008 at 4:39 PM, gordoncww <gord...@gmail.com> wrote:
>>>>
>>>> I'm trying to compile the google test libraries for use in a windows
>>>> ce app. It seems several of the .h files include sys/types which is
>>>> not available under for CE. Is there a workaround for this?
>>>>
>>>> Thanks in advance.
>>>
>>> Our initial release only supports building on Linux so there may be
>>> glitches on other platforms. We are working on getting the build
>>> support for other system ready.
>>>
>>> I don't have the Windows CE environment at hand, so I cannot readily
>>> investigate the problem you reported. If I remember correctly, we
>>> included sys/types.h for the definition of type size_t. Could you try
>>> to replace that #include with whatever header that defines size_t on
>>> CE? Let me know if that works. Thanks!
>>
>> Ahh, this is the culprit. <sys/types.h> isn't the correct header for
>> size_t. size_t is a C standard type, while <sys/types.h> is a POSIX
>> standard header. I believe the correct header is <stddef.h>, but I
>> don't have the standard here, so I'll have to double check that.
>
> Good point. Wikipedia says size_t is defined in stdlib.h.

Interesting, Wikipedia is wrong for C99, as 7.17.2 states that
stddef.h defines size_t, while later it says stdlib.h just declares
it. Looking at GCC's implementation, stdlib.h (naturally) includes
stddef.h, and even specifically mentions to pull in stdlib.h Either
should be sufficient to get size_t, with stddef.h being slightly more
precise and significantly more lightweight.

I also poked around C89, and it seems stddef.h is available there as
well and still defines size_t.

-Chandler

Zhanyong Wan (λx.x x)

unread,
Jul 8, 2008, 2:47:45 AM7/8/08
to Chandler Carruth, gordoncww, Google C++ Testing Framework

Thanks for checking. size_t is not a struct/union/class and thus
cannot be forward declared. Therefore I'm not sure what it means to
say that stdlib.h just declares it. Perhaps it really meant to say
"defines it".

> Looking at GCC's implementation, stdlib.h (naturally) includes
> stddef.h, and even specifically mentions to pull in stdlib.h Either
> should be sufficient to get size_t, with stddef.h being slightly more
> precise and significantly more lightweight.
>
> I also poked around C89, and it seems stddef.h is available there as
> well and still defines size_t.

I looked at the Google Test code. The offending header gtest-port.h
already includes stdlib.h, so that may be enough.

>
> -Chandler
>
>>
>> Gordon, could you remove the first "#include <sys/types.h>" in
>> include/gtest/internal/gtest-port.h and see if it works? Thanks,
>>
>>>
>>> -Chandler
>>>
>>>>
>>>> --
>>>> Zhanyong
>>>> _______________________________________________
>>>> opensource-gtest mailing list
>>>> opensour...@google.com
>>>> https://mailman.corp.google.com/mailman/listinfo/opensource-gtest
>>>>
>>>
>>
>>
>>
>> --
>> Zhanyong
>>
>

--
Zhanyong

gordoncww

unread,
Jul 8, 2008, 8:06:01 PM7/8/08
to Google C++ Testing Framework
Zhanyong,

That got rid of the error I was getting but now I'm running into
another.

`.\src\gtest-filepath.cc(36) : fatal error C1083: Cannot open include
file: 'direct.h': No such file or directory`

Unfortunately I'm a bit of a c++ and WinMo noob so my ability to
diagnose the problem is limited. Still, I think this is related to
the Win32 includes. direct.h is part of the windows sdk but not part
of the CE or WinMo SDK. It is being included b/c _WIN32 is defined at
compile time. I'm assuming this is default behavior for a WinMob5
project since I'm not explicitly defining it anywhere in my code
or .vcproj.

I don't want to spam the group w/my personal configuration problems.
But if it would be helpful for me to continue posting about this, I'm
happy to do so.

Gordon

On Jul 7, 11:14 pm, "Zhanyong Wan (λx.x x)" <w...@google.com> wrote:
> On Mon, Jul 7, 2008 at 5:30 PM, Chandler Carruth <chandl...@google.com> wrote:
> > On Mon, Jul 7, 2008 at 4:58 PM, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
>
> >> Hi, Gordon (?),
>
> >> opensource-gt...@google.com
> >>https://mailman.corp.google.com/mailman/listinfo/opensource-gtest
>
> --
> Zhanyong

Zhanyong Wan (λx.x x)

unread,
Jul 9, 2008, 1:18:37 AM7/9/08
to gordoncww, Google C++ Testing Framework
Hi, Gordon,

2008/7/8 gordoncww <gord...@gmail.com>:


>
> Zhanyong,
>
> That got rid of the error I was getting but now I'm running into
> another.
>
> `.\src\gtest-filepath.cc(36) : fatal error C1083: Cannot open include
> file: 'direct.h': No such file or directory`
>
> Unfortunately I'm a bit of a c++ and WinMo noob so my ability to
> diagnose the problem is limited. Still, I think this is related to
> the Win32 includes. direct.h is part of the windows sdk but not part
> of the CE or WinMo SDK. It is being included b/c _WIN32 is defined at
> compile time. I'm assuming this is default behavior for a WinMob5
> project since I'm not explicitly defining it anywhere in my code
> or .vcproj.
>
> I don't want to spam the group w/my personal configuration problems.
> But if it would be helpful for me to continue posting about this, I'm
> happy to do so.

I don't have access to a CE development environment, but I have asked
someone who does to help. If some of you can help, please don't be
shy. Thanks,

--
Zhanyong

Reply all
Reply to author
Forward
0 new messages