编译android的问题...'未在此范围内声明'错误

时间:2012-08-14 05:27:05

标签: android c++

大家好,另一个C ++编程问题。因为我刚刚开始学习C ++,所以再次对我很容易。我在编译时遇到错误,显示:

  

frameworks / native / libs / gui / SurfaceTextureClient.cpp:在成员函数'virtual int> android :: SurfaceTextureClient :: setUsage(uint32_t)'中:   frameworks / native / libs / gui / SurfaceTextureClient.cpp:498:20:错误:>'GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY'未在此范围内声明   frameworks / native / libs / gui / SurfaceTextureClient.cpp:503:23:错误:>'GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK'未在此范围内声明   frameworks / native / libs / gui / SurfaceTextureClient.cpp:505:30:错误:>'GRALLOC_USAGE_PRIVATE_EXTERNAL_CC'未在此范围内声明

这是'SurfaceTextureClient.cpp'文件:

 17 #define LOG_TAG "SurfaceTextureClient"
 18 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 19 //#define LOG_NDEBUG 0
 20
 21 #include <android/native_window.h>
 22 
 23 #include <utils/Log.h>
 24 #include <utils/Trace.h>
 25
 26 #include <gui/ISurfaceComposer.h>
 27 #include <gui/SurfaceComposerClient.h>
 28 #include <gui/SurfaceTexture.h>
 29 #include <gui/SurfaceTextureClient.h>
 30
 31 #include <private/gui/ComposerService.h>
 32 #ifdef QCOMHW
 33 #include <gralloc_priv.h>
 34 #endif
 35 
 36 namespace android {
 37 
 38 SurfaceTextureClient::SurfaceTextureClient(
 39         const sp<ISurfaceTexture>& surfaceTexture)
 40 {
 41     SurfaceTextureClient::init();
 42     SurfaceTextureClient::setISurfaceTexture(surfaceTexture);
 43 }
 44 
 45 // see SurfaceTextureClient.h
 46 SurfaceTextureClient::SurfaceTextureClient(const
 47          sp<SurfaceTexture>& surfaceTexture)
 48 {
 49     SurfaceTextureClient::init();
 50     SurfaceTextureClient::setISurfaceTexture(surfaceTexture->getBufferQueue());
 51 }
 52
 53 SurfaceTextureClient::SurfaceTextureClient() {
 54     SurfaceTextureClient::init();
 55 }
 56 
 57 SurfaceTextureClient::~SurfaceTextureClient() { 
 58     if (mConnectedToCpu) {
 59         SurfaceTextureClient::disconnect(NATIVE_WINDOW_API_CPU);
 60
 61 }

494 int SurfaceTextureClient::setUsage(uint32_t reqUsage)
493 {
494     ALOGV("SurfaceTextureClient::setUsage");
495     Mutex::Autolock lock(mMutex);
496 
497 #ifdef QCOMHW
498     if (reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY) {
499         //Set explicitly, since reqUsage may have other values.
500         mReqExtUsage = GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY;
501         //This flag is never independent. Always an add-on to
502         //GRALLOC_USAGE_EXTERNAL_ONLY
503         if(reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK) {
504             mReqExtUsage |= GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK;
505         } else if(reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_CC) {
506             mReqExtUsage |= GRALLOC_USAGE_PRIVATE_EXTERNAL_CC;
507         }
508     }
509 #endif

如果需要更多信息,请告诉我。修复了此编译的先前错误。不知道该怎么做这个。

1 个答案:

答案 0 :(得分:0)

我发现问题的解决方案我认为大声笑。在另一个目录下的源文件夹中有另一个gralloc_priv.h文件,并将该文件复制到该头文件中的未编写成员的声明中,并且它完成了。如果有人遇到这个问题,请告诉我,我会告诉你我在哪里找到这些文件。