Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Building HelloWorld on Linux, type "byte" is not defined #36

@juliusl

Description

@juliusl

Building the Linux sample, while including the ChakraCore header file will complain about the type byte not being defined.

The workaround I found was to just define the type on top of sample.cpp before #include "ChakraCore.h" (The type can be defined as typedef unsigned char byte;)

Not really sure the best way to fix this permanently which is why I'm not posting the workaround as a PR. I noticed a todo in the source for ChakraCommon.h mentioning to reduce the usage of these types for better x-plat, I guess eventually that would fix this build issue?

Here is the compilation error I get on Ubuntu 16.04 --

juliusl@jlubuntu:~/Github/chakracore/crossplatform$ make BUILD_TYPE=Debug
g++ sample.cpp -Wall -lstdc++ -std=c++0x -I../lib/Jsrt -Wl,--whole-archive ../BuildLinux/Debug/lib/../pal/src/libChakra.Pal.a ../BuildLinux/Debug/lib/Common/Core/libChakra.Common.Core.a ../BuildLinux/Debug/lib/Jsrt/libChakra.Jsrt.a -Wl,--no-whole-archive -pthread -lm -ldl -licuuc -lunwind-x86_64 -Wno-c++11-compat-deprecated-writable-strings -Wno-deprecated-declarations -Wno-unknown-warning-option -o sample.o
In file included from ../lib/Jsrt/ChakraCore.h:26:0,
                 from sample.cpp:6:
../lib/Jsrt/ChakraDebug.h:692:137: error: ‘byte’ does not name a type
     typedef void (CHAKRA_CALLBACK *JsTTDInitializeForWriteLogStreamCallback)(_In_ size_t uriByteLength, _In_reads_(uriByteLength) const byte* uriBytes);
                                                                                                                                         ^
../lib/Jsrt/ChakraDebug.h:708:139: error: ‘byte’ does not name a type
     typedef JsTTDStreamHandle (CHAKRA_CALLBACK *TTDOpenResourceStreamCallback)(_In_ size_t uriByteLength, _In_reads_(uriByteLength) const byte* uriBytes, _In_z_ const char* asciiResourceName, _In_ b
                                                                                                                                           ^
../lib/Jsrt/ChakraDebug.h:719:120: error: ‘byte’ has not been declared
     typedef bool (CHAKRA_CALLBACK *JsTTDReadBytesFromStreamCallback)(_In_ JsTTDStreamHandle handle, _Out_writes_(size) byte* buff, _In_ size_t size, _Out_ size_t* readCount);
                                                                                                                        ^
../lib/Jsrt/ChakraDebug.h:730:123: error: ‘byte’ does not name a type
     typedef bool (CHAKRA_CALLBACK *JsTTDWriteBytesToStreamCallback)(_In_ JsTTDStreamHandle handle, _In_reads_(size) const byte* buff, _In_ size_t size, _Out_ size_t* writtenCount);
                                                                                                                           ^
../lib/Jsrt/ChakraDebug.h:763:44: error: ‘byte’ does not name a type
             _In_reads_(infoUriCount) const byte* infoUri,
                                            ^
../lib/Jsrt/ChakraDebug.h:787:44: error: ‘byte’ does not name a type
             _In_reads_(infoUriCount) const byte* infoUri,
                                            ^
../lib/Jsrt/ChakraDebug.h:935:18: error: ‘byte’ has not been declared
             _In_ byte* initialModPos);
                  ^
../lib/Jsrt/ChakraDebug.h:945:18: warning: ‘JsTTDRawBufferAsyncModifyComplete’ initialized and declared ‘extern’
             _In_ byte* finalModPos);
                  ^
../lib/Jsrt/ChakraDebug.h:945:18: error: ‘byte’ was not declared in this scope
../lib/Jsrt/ChakraDebug.h:945:24: error: ‘finalModPos’ was not declared in this scope
             _In_ byte* finalModPos);
                        ^
cc1plus: warning: unrecognized command line option ‘-Wno-unknown-warning-option’
cc1plus: warning: unrecognized command line option ‘-Wno-c++11-compat-deprecated-writable-strings’
Makefile:34: recipe for target 'testmake' failed
make: *** [testmake] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions