Why "CCTextureCache+CCBigImageExtensions" isn't linked in my Kobold2D project? - cocos2d-iphone

I am using CCBigImage in an iOS/Kobold2d project as the sprite would be too big to be loaded at once. Unfortunately when executing the application it stops with
ERROR: Uncaught exception -[CCTextureCache
addImageFromAnotherThreadWithName:target:selector:]: unrecognized
selector sent to instance 0xa17d010
when loading the plist file into CCBigImage. I nailed it down to the point that
CCBigImage* bg = [CCBigImage nodeWithTilesFile:#"bg1dot5.plist" tilesExtension: #"pvr.ccz" tilesZ: 0]
calls CCBigImage load(). This method calls
[CCTextureCache sharedTextureCache] addImageFromAnotherThreadWithName: _imageName
target: self
selector: #selector(loadedTexture:)
that finally leads to the specified exception. I imported "CCTextureCache+CCBigImageExtensions.h" into the source file that loads the CCBigImage so I expected the given selector to be added to CCTextureCache but obviously it is not.
I am using Kobold2d 1.1.0 and XCode 4.3.3 (so all latest versions). Is there something else I need to do in order to have that selector being included?
I also called
[[CCTextureCache sharedTextureCache] addImageFromAnotherThreadWithName:#"" target:nil selector:nil];
directly, the project compiles fine as I included the extension header file but the same exception occures as when I load a CCBigImage.

Static libraries containing Objective-C categories must be force-linked with iOS apps (Mac apps don't have this problem) otherwise the category methods can not be resolved and you get the error you described. More info here.
It is not recommended to use the -all_load flag, particularly in Kobold2D. This would blindly link all available code to the app, even the code you're not using in your app. It basically makes the linker blind and stupid and the app size grows possibly by several megabytes.
I will add the force-link of the cocos2d extensions in future Kobold2D versions. For now the fix is to edit the FrameworksAndLibraries.xcconfig file, in Xcode in the Kobold2D-Libraries project in the BuildSettings group.
Locate the section where frameworks/libraries are force-loaded:
LINK_WITH_ADMOB = $(KKLIBROOT)/GoogleAdMobAdsSDK/libGoogleAdMobAds.a
FORCE_LOAD_COCOS2D = -force_load "$(BUILT_PRODUCTS_DIR)/libcocos2d-ios.a"
FORCE_LOAD_KOBOLD2D = -force_load "$(BUILT_PRODUCTS_DIR)/libkobold2d-ios.a"
FORCE_LOAD_KOBOLDSCRIPT = -force_load "$(BUILT_PRODUCTS_DIR)/libkoboldscript-ios.a"
FORCE_LOAD_KOBOLDSCRIPTWRAPPER = -force_load "$(BUILT_PRODUCTS_DIR)/libkoboldscriptwrapper-ios.a"
FORCE_LOAD_ISIMULATE = -force_load "$(KKLIBROOT)/iSimulateSDK/libisimulate-4.x-opengl.a"
FORCE_LOAD_COCOS3D = -force_load "$(BUILT_PRODUCTS_DIR)/libcocos3d-ios.a"
KKFW_IOS = $(KKFW_SysConfig) $(KKFW_AVFoundation) $(KKFW_CoreGraphics) $(KKFW_CoreLocation) $(KKFW_MediaPlayer) $(KKFW_OpenGLES) $(LINK_WITH_ADMOB) $(FORCE_LOAD_KOBOLD2D) $(FORCE_LOAD_KOBOLDSCRIPT) $(FORCE_LOAD_KOBOLDSCRIPTWRAPPER) $(FORCE_LOAD_COCOS2D)
Now add another FORCE_LOAD_… entry before the "KKFW_IOS = …" line to -force_load the cocos2d-extensions library (this is all in one line, I just added the line break for readability):
FORCE_LOAD_COCOS2D_EXTENSIONS =
-force_load "$(BUILT_PRODUCTS_DIR)/libcocos2d-extensions-ios.a"
Then append this new FORCE_LOAD_COCOS2D_EXTENSIONS entry at the end of the "KKFW_IOS = …" line (abbreviated for readability):
KKFW_IOS = $(KKFW_SysConfig) … $(FORCE_LOAD_COCOS2D_EXTENSIONS)
This should resolve the issue and you should now be able to use the CCBigImage category methods.

Related

Qt creator could not parse stddef.h --> incorrect code completion and highlighting

I am developing a QT GUI for my application using QT Creator (4.11.0).
Recently, our IT updated my OS to Ubuntu 20.04 (from 18.04) - maybe the error is related to that.
I have not touched to project in some month but yesterday wanted to continue developing it.
However, within the IDE there are now thousands of errors highlighted at almost every line of my code. (with highlighted I mean that there is this red background and a red dot beside the line number)
On the very top, it says:
Warning: The code model could not parse an included file, which might lead to incorrect code completion and highlighting, for example.
cstddef:50:10: fatal error: 'stddef.h' file not found
...
The errors that are listed in the IDE are very wired like:
type `QMainWindow`is not a direct or virtual base of `MainWindow` (my class is called `MainWindow`)
I'm pretty sure it is not related to my code:
the code compiles and works fine - it is really just the IDE that is highlighting errors at every line of my code.
I have the same code on a Windows Computer and there no errors are listed in the IDE.
even if I start a brand new QT Widget project the errors appear within the template code provided by the QT Creator.
Since the GCC version changed with the update of the OS, I thought maybe I have to define a new KIT but this also did not help.
Is there anything I can do to fix the issue?
Do I have to reinstall the QT Creator?
I know, pictures are not very well-liked but here I think it might help to understand what I mean with "IDE is highlighting errors":
1. First
~/.profile :
CPATH="/usr/include/clang/10/include:$CPATH"
C_INCLUDE_PATH="/usr/include/clang/10/include:$C_INCLUDE_PATH"
CPLUS_INCLUDE_PATH="/usr/include/clang/10/include:$CPLUS_INCLUDE_PATH"
export CPATH
export C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH
maybe /usr/include/clang/10/include see in you file system.
2. Second
Logout / login.
3. Third
Specifying Build Settings (Projects -> Build -> in every config build) in Build Environment section: [unset] CPATH, C_INCLUDE_PATH and CPLUS_INCLUDE_PATH
or [edit] replace this variable with the necessary values
I fixed this issue by sudo apt install clang-8.
Source: https://bugs.launchpad.net/ubuntu/+source/qtcreator/+bug/1890434

SwiftUI Preview fails with linker errors

I've trying to add a SwiftUI view to an existing UIKit + Storyboards based tvOS project. The actual build works fine and I can run in the simulator & see my SwiftUI view, but when I resume the SwiftUI preview I get 'Failed to build MyClass.swift' with the following diagnostics:
I saw this similar SO post regarding the -bundle and -bitcode_bundle cannot be used together error, but my configuration is already the way the answer suggests (setting the Mach-O type to Executable and ensuring no Bundle Loader is set).
There's also a warning about /Applications/Xcode.app/Contents/SharedFrameworks-appletvsimulator not being found. That directory certainly does not exist, but nowhere in my project is SharedFrameworks-appletvsimulator referenced that I can find. Also, if I create a new SwiftUI project it doesn't complain about that.
The SwiftUI code is literally just a new "Hello World" SwiftUI file from the Xcode template - I haven't modified it at all.
Does anyone have any ideas what's going on here or how to fix it?
For me the fix was disabling the code coverage option:
Go to your scheme menu -> select edit scheme -> go to the "Test" section on the left side menu -> uncheck the Code Coverage mark
I'm using Xcode 12.5
iOS minimum target 13.4
There are diffrent reasons for the preview to fails and several posts about it , for example:
This Question

Eclipse/wxWidgets - Cleaning leads to many errors

I'm trying to set up my first app using eclipse and wxwidgets on Mac.
I followed the wxwidgets guide and set up everything correctly.
I copied the HelloWorld.cpp to the project and built it. (Building was successful and I even get a .app file. But opening it says: Can't open it because it is damaged or uncomplete.
When I clean my project I get 33 error messages as:
Function "somefunction" could not be resolved
Invalid arguments '
Method "somemethod" could not be resolved
Type "sometype" could not be resolved
Did I forget to set up something?

yocto - using gdb with externalsrc

We’re extending an existing Yocto project. We’d like to be able to selectively modify components of the project and build using the local modifications, then debug those modifications with gdb.
We’ve added these features to get gdb and the debug symbol packages into the image:
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug"
IMAGE_FEATURES = "ssh-server-openssh dbg-pkgs"
We’ve added these variables to build from the local component code:
INHERIT += "externalsrc"
EXTERNALSRC_pn-[component] = “[local source code path]/[component]”
All seems well, as the build succeeds and the component in the image reflects local code changes. However, the component source code never makes it into the image, so it can’t be referenced in gdb.
Is there a secret to using dbg-pkgs and EXTERNALSRC together?
I believe this was due to a bug that was resolved in the 2.1 release, though I never pinpointed which commit actually resolved the issue. There's a bugzilla entry covering the issue - if you are still experiencing this with 2.1 please do let me know.

Firebreath plugin on windows fails to load in chrome

I am busy converting by existing firebreath plugin here to use gpgme instead of making calls via the OS and the gpg binary.
I have managed to get the code to compile in windows using VS 2010 on a x32 system but after loading the plugin into chrome I can not access the npapi code at all. Even simple version calls fails.
When loading the plugin I get no visible errors but when using sawbuck log viewer for chrome I get the erorr messages below.
.\renderer\webplugin_delegate_proxy.cc 347 PluginMsg_Init returned false
..\plugins\npapi\webplugin_impl.cc 271 Couldn't initialize plug-in
I have tried to use my code with both firebreath 1.4 and 1.6 and neither versions work. After some simple debugging it seems that using any code provided by gpgme (whether its called or not) causes the plugin to break.
I came to this conclusion by doing the following.
Created a new project with firebreath (versions 1.4 and 1.6)
Add the gpgme.h headers to gmailGPGAPI.cpp and changed nothing else aside from adding the required reference paths to the project.
Build the project to create the dll (this generates the dll fine).
Replace the existing ddl in my project with the dll in step 2 and test it with the following piece of code
plugin = document.createElement('object'); plugin.id = 'plugin';
plugin.type = 'application/x-gmailtest';
document.body.appendChild(plugin);
console.log("my plugin returned: "+ plugin.valid);
console.log("my plugin returned: " + plugin.version);
This returns valid = true and the version returns what ever i set it to.
I then modified gmailGPGAPI.cpp to now return the gpg version by calling gpgme_check_version(NULL) in the version method. I used that method because its probably the simplest returning function that I could test with.
Build the plugin and copy dll to chrome extension as in step 3-4. The plugin builds fine again as expected.
Load the plugin and try to execute the code in step 4 at which point it now just returns undefined for any property or method i try to access on the plugin. No errors are printed to the console or anywhere else in chrome except for the error logged to sawbuck.
I have got no idea where to look or what to try since I cant seem to get an actionable error to work against. I have also reduced by test code to the point where its just a new project with a one line change to make it easier to find the problem.
I should note the code in the repo builds fine in linux/OSX and loads into chrome correctly so I know at some level my code does work.
Two possible paths:
You may have a DLL dependency that isn't available which keeps the plugin from loading; if you run regsvr32 on it in the state where it doesn't work on chrome, does it work?
Your plugin may be loading and then crashing. Start chrome with --plugin-startup-dialog and then when it pops up a dialog warning you that a plugin is about to be loaded attach to that process and see if the process crashes. At this point you can also set breakpoints to try to figure out how far it gets.
Double check your metadata in PluginConfig.cmake as well; sometimes unusual characters in some fields can cause issues like this.