Cocos2dx android Werror=format-security
Had some troubles with using CCLOG() together with c_str(). Received errors of type [-Werror=format-security]
To solve that I added this to my Application.mk
APP_CFLAGS += -Wno-error=format-security

@theartofmadeline

titsay
macklin celebrini has autism

★
Monterey Bay Aquarium
YOU ARE THE REASON
will byers stan first human second
No title available
Noah Kahan
The Stonewall Inn
Fai_Ryy
Sweet Seals For You, Always
NASA
EXPECTATIONS

oozey mess

Origami Around
Cosimo Galluzzi
sheepfilms
RMH

bliss lane
seen from United States

seen from Italy
seen from United States
seen from Venezuela
seen from Venezuela

seen from Italy
seen from United States

seen from Brazil

seen from Netherlands
seen from China

seen from Italy

seen from United States

seen from Germany
seen from China
seen from United States
seen from United Kingdom

seen from United States
seen from United States
seen from Bangladesh

seen from Russia
@lovedevshit
Cocos2dx android Werror=format-security
Had some troubles with using CCLOG() together with c_str(). Received errors of type [-Werror=format-security]
To solve that I added this to my Application.mk
APP_CFLAGS += -Wno-error=format-security
Converting int to string
#include <iostream> #include <sstream> const char* value = "1234567"; stringstream strValue; strValue << value; unsigned int intValue; strValue >> intValue; cout << value << endl; cout << intValue << endl;
Casting const unsigned char* to char*
char* c = (char*)methodThatReturnsConstUnsignedCharPointer();
Seems to work?
Comparing two char* with same string values.
char* a = "1"; char* b = "1"; if(a == b){...}
Yes. I thought this was just a simple comparison. Had no idea why the code above didn't work.
Instead you should use strcmp.
char* a = "1"; char* b = "1"; if(strcmp(a, b) == 0){...}
What does for(;;) mean?
You might, like I did, wonder what this mean:
for(;;){ ...}
It's an infinite loop, like while(true){...}
How to not waste time on stupid compiler errors.
Error 7 error LNK2019: unresolved external symbol _sqlite3_open referenced in function..
So what I learned was to solve the LNK2019 error I had to import the sqlite3.lib file in the Linker > Input > Additional Dependencies.
Boy I felt stupid.
CCLOG("debug");
Use CCLOG() for sending log messages. Very straight forward to make it work. The only thing you need to prepare is that you must add the text below to be able to use CCLOG() command on your mobile devices.
#define COCOS2D_DEBUG 1
ANDROID - Y U NO BUILD?
Maybe you ask yourself why your android build is not working.
Files are missing even though you added them.
Enter android.mk, add these lines. No more manually adding of files.
HELLOCPP_FILES := $(wildcard $(LOCAL_PATH)/hellocpp/*.cpp) HELLOCPP_FILES := $(HELLOCPP_FILES:$(LOCAL_PATH)/%=%) CLASSES_FILES := $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp) CLASSES_FILES := $(CLASSES_FILES:$(LOCAL_PATH)/%=%) LOCAL_SRC_FILES := $(HELLOCPP_FILES) LOCAL_SRC_FILES += $(CLASSES_FILES)
set width, set height
Not sure yet if this is because of C++ or Cocos2dx but apparently there's no setWidth / setHeight methods so you have to use setScale(x,y);
wtf?
pre-introduction
Hey devs!
I'm about to start coding a cocos2dx project in C++. I've been working as a AS3 game developer for many years but c++ is new to me.
In this blog I will share the annoying part that gives me trouble on my path of developing a game.