# ThirdParty/libJPG/jpgd.cpp:569:266: error: shifting a negative signed value is undefined \[-Werror,-Wshift-negative-value\]

**URL:** <https://forums.unrealengine.com/t/thirdparty-libjpg-jpgd-cpp266-error-shifting-a-negative-signed-value-is-undefined-werror-wshift-negative-value/337156>\
**Category:** Platform & Builds\
**Tags:** ubuntu, Linux, unreal-engine, bug-report, CPP, question\
**Created:** [November 2, 2015, 4:06am UTC](https://forums.unrealengine.com/t/thirdparty-libjpg-jpgd-cpp266-error-shifting-a-negative-signed-value-is-undefined-werror-wshift-negative-value/337156 "2015-11-02T04:06:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LuisAlaguna](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luisalaguna/32/570408_2.png) [@LuisAlaguna](https://forums.unrealengine.com/u/LuisAlaguna)\
**Post date:** [November 2, 2015, 4:06am UTC](https://forums.unrealengine.com/t/thirdparty-libjpg-jpgd-cpp266-error-shifting-a-negative-signed-value-is-undefined-werror-wshift-negative-value/337156/1 "2015-11-02T04:06:47Z")

</div>

Guys, i get this error today when i was making the SlateViewer:

```
    [13/44] Compile Module.AppFramework.cpp
    In file included from /home/tulipanrog/UnrealEngine/Engine/Intermediate/Build/Linux/x86_64-unknown-linux-gnu/SlateViewer/Development/ImageWrapper/Module.ImageWrapper.cpp:9:
    In file included from /home/tulipanrog/UnrealEngine/Engine/Source/Developer/ImageWrapper/Private/JpegImageWrapper.cpp:14:
    ThirdParty/libJPG/jpgd.cpp:569:51: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                         ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:66: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                        ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:81: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                       ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:96: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                      ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:111: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                     ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:126: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                    ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:141: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                   ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:156: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                  ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:171: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                 ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:186: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:202: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                                ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:218: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                                                ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:234: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                                                                ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:250: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                                                                                ~~~~ ^
    ThirdParty/libJPG/jpgd.cpp:569:266: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                                                                                                ~~~~ ^
    15 errors generated.

```

I don’t know why happen this, i using clang-3.7.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e2d11dd6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e2d11dd6](https://forums.unrealengine.com/u/anonymous_user_e2d11dd6)\
**Post date:** [November 2, 2015, 5:31pm UTC](https://forums.unrealengine.com/t/thirdparty-libjpg-jpgd-cpp266-error-shifting-a-negative-signed-value-is-undefined-werror-wshift-negative-value/337156/2 "2015-11-02T17:31:14Z")

</div>

see: [Compile and Start Error under Linux - C++ - Epic Developer Community Forums](https://forums.unrealengine.com/showthread.php?89334-Compile-and-Start-Error-under-Linux)

---

<div class="post-metadata">

**Author:** ![LuisAlaguna](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luisalaguna/32/570408_2.png) [@LuisAlaguna](https://forums.unrealengine.com/u/LuisAlaguna)\
**Post date:** [November 2, 2015, 6:11pm UTC](https://forums.unrealengine.com/t/thirdparty-libjpg-jpgd-cpp266-error-shifting-a-negative-signed-value-is-undefined-werror-wshift-negative-value/337156/3 "2015-11-02T18:11:02Z")

</div>

I solved this installing libjpeg-dev.
