解决Cygwin编译cocos2dx 遇到的 error: 'UINT64_C' was not declared in this scope 问题

环境工具:Win10、VS2013、cocos2d-x-2.2.6、Cygwin、ADT

问题来源:写了一个小游戏,VS2013上运行成功,就尝试着打包apk,项目导入到ADT里面,添加了cocos2dx lib库以后,讨厌的红x消失,下来就是在cygwin里面预编译得到xxx.so文件了,但是问题来了,报错!!!

jni/../../Classes/GameLayer.cpp:227:46: error: ‘UINT64_C‘ was not declared in this scope

怎么解决呢?

看了一下‘UINT64_C‘的定义文件 stdint.h 路径显示是vs自带的,好像有点复杂了

那‘UINT64_C‘是什么呢?

经过查资料,简单的说,是一种数据类型,编译的时候默认是C文件来编译的,但是我用的是C++,错误便出现了。

既然是在打包apk的路上出的错,问题差不多就得往这方面考虑解决,于是查资料了解到

LOCAL_CFLAGS变量为C/C++编译器定义额外的标志,当编译C/C++源文件时传递一个可选的编译器标志,这对于指定额外的宏定义或编译选项很有用。

解决方案:

在Android.mk文件里添加:

LOCAL_CFLAGS := -D__STDC_CONSTANT_MACROS

问题得以解决。

解决Cygwin编译cocos2dx 遇到的 error: 'UINT64_C' was not declared in this scope 问题

时间: 2024-12-19 02:59:13

解决Cygwin编译cocos2dx 遇到的 error: 'UINT64_C' was not declared in this scope 问题的相关文章

In function 'int av_clipl_int32_c(int64_t)': error: 'UINT64_C' was not declared in this scope

cygwin下使用ndk编译jni时遇到的错误: /ffmpeg/include/libavutil/common.h: In function 'int av_clipl_int32_c(int64_t)': /ffmpeg/include/libavutil/common.h:178:47: error: 'UINT64_C' was not declared in this scope 解决方法: 修改头文件 /ffmpeg/include/libavutil/common.h 添加如下代

mips交叉编译 error: 'PTHREAD_MUTEX_ERRORCHECK_NP' was not declared in this scope

在mips交叉编译时,设置互斥锁时,报以下错误,始终编译不过去. error: 'PTHREAD_MUTEX_ERRORCHECK_NP' was not declared in this scope 各种百度,相关信息一条也没有找到,实在没办法了,各种尝试. 打开linux平台和mips平台的pthread.h一对比才恍然大悟,原来在mips平台上,互斥锁类型使用的是: #define PTHREAD_MUTEX_NORMAL 0 #define PTHREAD_MUTEX_DEFAULT 0

error: 'LOGE' was not declared in this scope

移植了下HAL,发现编译出现如下错误 error: 'LOGE' was not declared in this scope 比较了一下android4.1的 system/core/include/cutils/log.h和android4.0的对应文件, 发现在4.1当中已经将所有的LOG宏前面加了一个字母A .所以出现上述编译错误. 修改HAL层源码:将LOGE   LOGD等等全部加个A 方法: `grep  LOG  -rl  .` 附上一个linux中的字符串查找替换用法: Lin

【Cocos2d-x】编译Android工程时提示error: 'GL_LINE_SMOOTH' was not declared in this scope

在Cocos2d-x项目中用到了OpenGL,使用GL_LINE_SMOOTH开启线条抗锯齿.代码如下: ccDrawColor4B(50, 26, 12, 255); // 设置线宽 glLineWidth(2.0f); // 启用线段反锯齿 glEnable(GL_LINE_SMOOTH); // 画第一条线 ccDrawLine(startPoint1,endPoint); // 画第二条线 ccDrawLine(startPoint2,endPoint); // 关闭线段反锯齿 glDi

编译是报error: 'EVNET_COME_TO_FOREGROUND' was not declared in this scope

Compile++ thumb  : game_shared <= main.cpp jni/hellocpp/main.cpp: In function 'void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv*, jobject, jint, jint)': jni/hellocpp/main.cpp:25:10: error: 'CCDirector' has not been declared jni/hellocpp/

qt-everywhere-opensource-src-4.8.1 出错:error: &#39;IPV6_MULTICAST_HOPS&#39; was not declared in this scope

在编译:qt-everywhere-opensource-src-4.8.1出现如下错误: /opt/buildroot-2011.11/arm920t/usr/bin/arm-linux-g++ -c -include .pch/release-shared-emb-arm/QtNetwork -pipe -fno-exceptions -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC

error: `cout&#39; was not declared in this scope

原因:C++ 1998 要求cout and endl被调用使用'std::cout'和'std::endl'格式,或using namespace std; 修改后:#include<iostream> std::cout << "Hello World!" << std::endl; 或者 #include<iostream>using namespace std; error: `cout' was not declared in

解决php编译报错configure: error: mcrypt.h not found. Please reinstall libmcrypt.

yum install -y epel-releaseyum install -y libmcrypt-devel 原文地址:https://www.cnblogs.com/finnlee/p/8992374.html

【STL源码剖析】--error: ‘power’ was not declared in this scope

#include <numeric> #include <vector> #include <iterator> #include <iostream> using namespace std; int main(int argc, char **argv) { int iArray[5] = {1, 2, 3, 4, 5}; vector<int> iVect(iArray, iArray+5); cout << accumulat