使用 gralloc_priv.h 文件编译时出错
Error compiling with gralloc_priv.h file
编程新手,所以对我来说很容易。我在编译 AOSP rom 时收到错误。如果有帮助的话,我正在 Ubuntu 12.04 内核 3.2.0.29 上完成所有这些操作。
这是我收到的错误:
device/lge/c800/include/gralloc_priv.h: 在成员函数'T& Queue::getHeadValue()\> const'中: device/lge/c800/include/gralloc_priv.h:169:55:错误:没有依赖于模板参数的"LOGE>"参数,因此必须提供"LOGE"声明[-fallowive] device/lge/c800/include/gralloc_priv.h:169:55:注意:(如果你使用'-fpermissive',G++>接受你的代码,但允许使用未声明的名称是不推荐
使用的)
这是头文件中与它相关的代码部分:
/*
* 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;
}
如果有人可以帮助解决此错误并向我解释,那将非常有帮助。如果需要更多信息,我会发布任何需要的信息。我可能会在这里发布更多错误,但想看看我如何处理第一篇文章。提前感谢大家。
你能在gralloc_priv.h
之前尝试在代码中包含#include <cutils/log.h>
吗?
或按照错误输出的建议使用参数-fpermissive
进行编译。
相关文章:
- 在Linux for Windows上编译C++代码时出错
- 为x86而非x64编译时出错
- 当我尝试通过 mingw 使用 CMake 和 SFML 库编译项目时出错
- 尝试在Windows上执行C++时出错(通过MinGW编译)
- 如何使用我构建的库,而不会从源代码出错,但不为我自己的项目编译?
- constexpr 使用 clang 编译 TensorFlow 时出错
- 从DLL导出函数,LoadLibrary()需要用TEXT转换的字符串才能编译而不会出错
- 编译包含指向模板函数的指针的初始值设定项列表时,gcc 出错,但 clang 不出错
- 编译时出错 - 从 DWORD 到 LPCVOID 的转换
- 在发布模式下启动使用库的静态链接编译的应用程序时出错
- 编译时出错 - 链接.cpp和头文件
- <limits> 使用 VSC2019 编译旧代码时出错
- 在 ubuntu 焦点上编译虚幻引擎 4.25 时出错
- 编译包含LLVM API标头的C++文件时出错
- 编译以下代码时出错
- 使用交叉工具ng编译gcc时出错
- 在 dll 中为 qLibrary 编译 qobject 时出错
- QML/C++编译出错
- Proc*C编译出错
- 应用程序在编译出错后执行时关闭,但在调试时运行良好