android - Cannot use CCLOG in eclipse. the msg won't show up in my LogCat -
please, me. thank much. new , learning develop android app watching tutorial video. trying use cclog in eclipse. uppercase. try print following msg.
cclog("test string"); cclog("visiblesize:%.1f,%.1f",visiblesize.width,visiblesize.height); cclog("origin:%.1f,%.1f",origin.x,origin.y);
they don't show in eclipse logcat, when use visual studio, show in output.
i have tried following methods. didn't work.
put #define cocos2d_debug 1 @ top (higher #include) in cpp file
add -dccocos2d_debug=1 in application.mk file this: app_cppflags := -frtti -dcc_enable_chipmunk_integration=1 -std=c++11 -fsigned-char -dccocos2d_debug=1
it helloworldscene of cocos2d-x
#define cocos2d_debug 1 #include "helloworldscene.h" using_ns_cc; scene* helloworld::createscene() { // 'scene' autorelease object auto scene = scene::create(); // 'layer' autorelease object auto layer = helloworld::create(); // add layer child scene scene->addchild(layer); // return scene return scene; } // on "init" need initialize 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 menu item "x" image, clicked quit program // may modify it. // add "close" icon exit progress. it's 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 autorelease object auto menu = menu::create(closeitem, null); menu->setposition(vec2::zero); this->addchild(menu, 1); ///////////////////////////// // 3. add codes below... // add label shows "hello world" // create , initialize label auto label = label::createwithttf("hello world", "fonts/marker felt.ttf", 24); // position label on center of screen label->setposition(vec2(origin.x + visiblesize.width/2, origin.y + visiblesize.height - label->getcontentsize().height)); // add label child layer this->addchild(label, 1); // add "helloworld" splash screen" auto sprite = sprite::create("helloworld.png"); // position sprite on center of screen sprite->setposition(vec2(visiblesize.width/2 + origin.x, visiblesize.height/2 + origin.y)); // add sprite child 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 }
thank helping me
i did in appdelegate.h:
#ifndef _app_delegate_h_ #define _app_delegate_h_ #define cocos2d_debug 1 #include "cocos2d.h" .. other stuff #endif // _app_delegate_h_
and in 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
try works me in eclipse. if not can try adding:
android:debuggable="true"
in androidmanifest.xml
Comments
Post a Comment