使用gralloc_priv.h文件编译错误 [英] Error compiling with gralloc_priv.h file

查看:784
本文介绍了使用gralloc_priv.h文件编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的编程,所以容易在我。我在编译AOSP rom时收到错误。我做所有这一切在Ubuntu 12.04内核3.2.0.29如果这有助于任何。

New to programming so be easy on me. I'm receiving an error while compiling for an AOSP rom. I'm doing all of this on Ubuntu 12.04 kernel 3.2.0.29 if that helps any.

这是我收到的错误:


device / lge / c800 / include / gralloc_priv.h:在成员函数'T& Queue :: getHeadValue()\> const':
device / lge / c800 / include / gralloc_priv.h:169:55:错误:没有参数'LOGE'>依赖于模板参数,所以必须提供一个LOGE的声明[-fpermissive]
device / lge / c800 / include / gralloc_priv.h:169:55:注意:(如果你使用'-fpermissive',G ++会接受你的代码,但允许使用未声明的名称已弃用)

device/lge/c800/include/gralloc_priv.h: In member function 'T& Queue::getHeadValue()\ > const': device/lge/c800/include/gralloc_priv.h:169:55: error: there are no arguments to 'LOGE' that > depend on a template parameter, so a declaration of 'LOGE' must be available [-fpermissive] device/lge/c800/include/gralloc_priv.h:169:55: note: (if you use '-fpermissive', G++ will > accept your code, but allowing the use of an undeclared name is deprecated)

这是与头文件相关的代码段:

This is the section of code that it relates to in the header file:

/*
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GRALLOC_PRIV_H_
#define GRALLOC_PRIV_H_

#include <stdint.h>
#include <limits.h>
#include <sys/cdefs.h>
#include <hardware/gralloc.h>
#include <pthread.h>
#include <errno.h>
#include <unistd.h>

#include <cutils/native_handle.h>

#include <linux/fb.h>

#if defined(__cplusplus) && defined(HDMI_DUAL_DISPLAY)
#include "overlayLib.h"
using namespace overlay;
#endif

enum {
    /* gralloc usage bits indicating the type
     * of allocation that should be used */

    /* ADSP heap is deprecated, use only if using pmem */
    GRALLOC_USAGE_PRIVATE_ADSP_HEAP       =       GRALLOC_USAGE_PRIVATE_0,
    /* SF heap is used for application buffers, is not secured */
    GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP  =       GRALLOC_USAGE_PRIVATE_1,
    /* SMI heap is deprecated, use only if using pmem */
    GRALLOC_USAGE_PRIVATE_SMI_HEAP        =       GRALLOC_USAGE_PRIVATE_2,
    /* SYSTEM heap comes from kernel vmalloc,
     * can never be uncached, is not secured*/
    GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP     =       GRALLOC_USAGE_PRIVATE_3,
    /* IOMMU heap comes from manually allocated pages,
     * can be cached/uncached, is not secured */
    GRALLOC_USAGE_PRIVATE_IOMMU_HEAP      =       0x01000000,
    /* MM heap is a carveout heap for video, can be secured*/
    GRALLOC_USAGE_PRIVATE_MM_HEAP         =       0x02000000,
    /* WRITEBACK heap is a carveout heap for writeback, can be secured*/
    GRALLOC_USAGE_PRIVATE_WRITEBACK_HEAP  =       0x04000000,
    /* CAMERA heap is a carveout heap for camera, is not secured*/
    GRALLOC_USAGE_PRIVATE_CAMERA_HEAP     =       0x08000000,

    /* Set this for allocating uncached memory (using O_DSYNC)
     * cannot be used with noncontiguous heaps */
    GRALLOC_USAGE_PRIVATE_UNCACHED        =       0x00100000,

    /* This flag needs to be set when using a non-contiguous heap from ION.
     * If not set, the system heap is assumed to be coming from ashmem
     */
    GRALLOC_USAGE_PRIVATE_ION             =       0x00200000,

    /* This flag can be set to disable genlock synchronization
     * for the gralloc buffer. If this flag is set the caller
     * is required to perform explicit synchronization.
     * WARNING - flag is outside the standard PRIVATE region
     * and may need to be moved if the gralloc API changes
     */
    GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED  =       0X00400000,

    /* Set this flag when you need to avoid mapping the memory in userspace */
    GRALLOC_USAGE_PRIVATE_DO_NOT_MAP      =       0X00800000,

    /* Buffer content should be displayed on an external display only */
    GRALLOC_USAGE_EXTERNAL_ONLY           =       0x00010000,

    /* Only this buffer content should be displayed on external, even if
     * other EXTERNAL_ONLY buffers are available. Used during suspend.
     */
    GRALLOC_USAGE_EXTERNAL_BLOCK          =       0x00020000,
};

enum {
    /* Gralloc perform enums
    */
    GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER = 0x080000001,
};


enum {
    GPU_COMPOSITION,
    C2D_COMPOSITION,
    MDP_COMPOSITION,
    CPU_COMPOSITION,
};

/* numbers of max buffers for page flipping */
#define NUM_FRAMEBUFFERS_MIN 2
#define NUM_FRAMEBUFFERS_MAX 3

/* number of default bufers for page flipping */
#define NUM_DEF_FRAME_BUFFERS 2
#define NO_SURFACEFLINGER_SWAPINTERVAL
#define INTERLACE_MASK 0x80
#define S3D_FORMAT_MASK 0xFF000
#define COLOR_FORMAT(x) (x & 0xFFF) // Max range for colorFormats is 0 - FFF
#define DEVICE_PMEM "/dev/pmem"
#define DEVICE_PMEM_ADSP "/dev/pmem_adsp"
#define DEVICE_PMEM_SMIPOOL "/dev/pmem_smipool"
/*****************************************************************************/
#ifdef __cplusplus

//XXX: Remove framebuffer specific classes and defines to a different header
template <class T>
struct Node
{
    T data;
    Node<T> *next;
};


template <class T>
struct Node
{
    T data;
    Node<T> *next;
};

template <class T>
class Queue
{
public:
    Queue(): front(NULL), back(NULL), len(0) {dummy = new T;}
    ~Queue()
    {
        clear();
        delete dummy;
    }
    void push(const T& item)   //add an item to the back of the queue
    {
        if(len != 0) {         //if the queue is not empty
            back->next = new Node<T>; //create a new node
            back = back->next; //set the new node as the back node
            back->data = item;
            back->next = NULL;
        } else {
            back = new Node<T>;
            back->data = item;
            back->next = NULL;
            front = back;
       }
       len++;
    }
    void pop()                 //remove the first item from the queue
    {
        if (isEmpty())
            return;            //if the queue is empty, no node to dequeue
        T item = front->data;
        Node<T> *tmp = front;
        front = front->next;
        delete tmp;
        if(front == NULL)      //if the queue is empty, update the back pointer
            back = NULL;
        len--;
        return;
    }
    T& getHeadValue() const    //return the value of the first item in the queue
    {                          //without modification to the structure
        if (isEmpty()) {
            LOGE("Error can't get head of empty queue");
            return *dummy;
        }
        return front->data;
    }

    bool isEmpty() const       //returns true if no elements are in the queue
    {
        return (front == NULL);
    }

    size_t size() const        //returns the amount of elements in the queue
    {
        return len;
    }

如果任何人可以帮助解决这个错误, 。如果需要更多信息,我会发布任何所需的。我可能会在这里发布更多的错误,但想看看我如何做这第一篇文章。感谢所有的提前。

If anyone can help with this error and explain it to me would be very helpful. If more info is needed I will post whatever is needed. I will probably be posting a few more errors here but wanted to see how I do with this first post. Thanks to all in advance.

推荐答案

您可以尝试并加入 #include< cutils / log.h>

或使用参数编译时,在代码 fpermissive 作为错误输出建议。

or compile with parameter -fpermissive as the error output suggests.

这篇关于使用gralloc_priv.h文件编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆