Android 无法在eclipse中使用CCLOG。味精赢了';我不会出现在我的日志里

Android 无法在eclipse中使用CCLOG。味精赢了';我不会出现在我的日志里,android,c++,eclipse,cocos2d-x,cocos2d-x-3.0,Android,C++,Eclipse,Cocos2d X,Cocos2d X 3.0,请帮帮我。非常感谢你。 我是一个新手,我正在通过观看一些教程视频来学习开发android应用程序。 我试图在eclipse中使用CCLOG。全部大写。 尝试打印以下消息 CCLOG("Test String"); CCLOG("visibleSize:%.1f,%.1f",visibleSize.width,visibleSize.height); CCLOG("origin:%.1f,%.1f",origin.x,origin.y); 它们不会显示在EclipseLogcat中,但当我使用V

请帮帮我。非常感谢你。 我是一个新手,我正在通过观看一些教程视频来学习开发android应用程序。 我试图在eclipse中使用CCLOG。全部大写。 尝试打印以下消息

CCLOG("Test String");
CCLOG("visibleSize:%.1f,%.1f",visibleSize.width,visibleSize.height);
CCLOG("origin:%.1f,%.1f",origin.x,origin.y);
它们不会显示在EclipseLogcat中,但当我使用VisualStudio时,它们会显示在输出中

我试过以下方法。但它们没有起作用

  • 将#define COCOS2D_DEBUG 1放在cpp文件的真正顶部(高于任何#include)

  • 在Application.mk文件中添加-DCCOCOS2D_DEBUG=1,如下所示: APP\u CPPFLAGS:=-frti-DCC\u ENABLE\u CHIPMUNK\u INTEGRATION=1-std=c++11-fsigned char-dccococs2d\u DEBUG=1

  • 这只是cocos2d-x的HelloWorld场景

    #define COCOS2D_DEBUG 1
    #include "HelloWorldScene.h"
    
    USING_NS_CC;
    
    Scene* HelloWorld::createScene()
    {
    // 'scene' is an autorelease object
    auto scene = Scene::create();
    
    // 'layer' is an autorelease object
    auto layer = HelloWorld::create();
    
    // add layer as a child to scene
    scene->addChild(layer);
    
    // return the scene
    return scene;
    }
    
    // on "init" you need to initialize your instance
    bool HelloWorld::init()
    {
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    CCLOG("Test String");
    CCLOG("visibleSize:%.1f,%.1f",visibleSize.width,visibleSize.height);
    CCLOG("origin:%.1f,%.1f",origin.x,origin.y);
    
    
    
    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.
    
    // add a "close" icon to exit the progress. it's an autorelease object
    auto closeItem = MenuItemImage::create(
                                           "CloseNormal.png",
                                           "CloseSelected.png",
                                           CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
    
    closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
                                origin.y + closeItem->getContentSize().height/2));
    
    // create menu, it's an autorelease object
    auto menu = Menu::create(closeItem, NULL);
    menu->setPosition(Vec2::ZERO);
    this->addChild(menu, 1);
    
    /////////////////////////////
    // 3. add your codes below...
    
    // add a label shows "Hello World"
    // create and initialize a label
    
    auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24);
    
    // position the label on the center of the screen
    label->setPosition(Vec2(origin.x + visibleSize.width/2,
                            origin.y + visibleSize.height - label->getContentSize().height));
    
    // add the label as a child to this layer
    this->addChild(label, 1);
    
    // add "HelloWorld" splash screen"
    auto sprite = Sprite::create("HelloWorld.png");
    
    // position the sprite on the center of the screen
    sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    
    // add the sprite as a child to this layer
    this->addChild(sprite, 0);
    
    return true;
    }
    
    
    void HelloWorld::menuCloseCallback(Ref* pSender)
    {
    Director::getInstance()->end();
    
    #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
        exit(0);
    #endif
    }
    

    感谢您帮助我

    我是在AppDelegate中完成的。h:

    #ifndef  _APP_DELEGATE_H_
    #define  _APP_DELEGATE_H_
    
    #define COCOS2D_DEBUG 1
    #include "cocos2d.h"
    
    .. other stuff
    
    #endif // _APP_DELEGATE_H_
    
    在Application.mk中:

    APP_STL := gnustl_static
    
    APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DCCOCOS2D_DEBUG=1
    APP_LDFLAGS := -latomic
    
    APP_PLATFORM := android-11
    APP_ABI=armeabi
    
    #ifeq ($(NDK_DEBUG),1)
    NDK_DEBUG:=1
    APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
    APP_OPTIM := debug
    #else
    #  APP_CPPFLAGS += -DNDEBUG
    #  APP_OPTIM := release
    #endif
    
    试试这个,它在eclipse中对我有效。如果没有,您也可以尝试添加:

    android:debuggable="true"
    

    在AndroidManifest.xml中,确保使用调试日志级别。您还可以检查普通System.out.println或Log.d是否显示?您好。是的System.out.ptintln显示。我不知道为什么在我尝试System.out.println之后,CCLOG突然工作了。我没有更改任何设置或编辑我的代码。真奇怪。非常感谢你的帮助。非常感谢。