你好傢伙另一個C++編程問題。當我剛開始學習C++時,再次輕鬆一點。我得到在編譯時,顯示一個錯誤:針對android編譯的問題...'在此範圍內沒有聲明'錯誤
frameworks/native/libs/gui/SurfaceTextureClient.cpp: In member function 'virtual int >android::SurfaceTextureClient::setUsage(uint32_t)': frameworks/native/libs/gui/SurfaceTextureClient.cpp:498:20: error: >'GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY' was not declared in this scope frameworks/native/libs/gui/SurfaceTextureClient.cpp:503:23: error: >'GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK' was not declared in this scope frameworks/native/libs/gui/SurfaceTextureClient.cpp:505:30: error: >'GRALLOC_USAGE_PRIVATE_EXTERNAL_CC' was not declared in this scope
這裏是「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
如果需要更多的信息讓我知道。修復了此編譯的以前的錯誤。不知道在這裏用這個做什麼。
「GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY」聲明在哪裏? – 2012-08-14 05:28:42
這裏是鏈接到以前的職位與gralloc ...頭文件: – dru 2012-08-14 05:34:39
http://stackoverflow.com/questions/11923550/error-compiling-with-gralloc-priv-h-file – dru 2012-08-14 05:35:29