Cocos compile --android-studio - cocos2d-x

cocos2d-x 3.14.1, ndk r13b
'Standard' compile command works fine:
cocos compile -p android -m debug --ap android-23
I get an apparent link error when I compile using this command:
cocos compile -p android -m debug --ap android-23 --android-studio
Error:
jni/../../../Classes/AppDelegate.cpp:289: error: undefined reference to 'MainMenu::createScene()'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libMyGame.so] Error 1
Error running command, return code: 2.
Struggling with this - any ideas please?

It seems you haven't added the MainMenu class in Android.mk for Android Studio.
Open the android.mk from following path:
~project-directory/proj.android-studio/app/jni/android.mk
Add all the classes that you have in the following manner:
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../../Classes/AppDelegate.cpp \
../../../Classes/HelloWorldScene.cpp
Note: Edit the above classes with your actual names.HelloWorldScene.cpp is just used for representation purposes.

Related

no cuda compatible device detected on nsight eclipse. why?

i'm writing a simple code for fast fourier transform with cufft cuda library. My source file work well with visual studio in windows7 but with eclipse nsight, in ubuntu 14.04, not work!
i've installed nvidia 346.72 driver and cuda toolkit 7.0 and my video hardware is geforce 410M. When i build my source code i have following message:
16:56:24 **** Incremental Build of configuration Debug for project cufft_double ****
make all
Building target: cufft_double
Invoking: NVCC Linker
/usr/local/cuda-7.0/bin/nvcc --cudart static -L/usr/local/cuda-7.0/lib64 --relocatable-device-code=false -gencode arch=compute_20,code=compute_20 -gencode arch=compute_20,code=sm_20 -m64 -link -o "cufft_double" ./cufft_double.o
./cufft_double.o: In function `main':
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:79: undefined reference to `cufftPlan1d'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:85: undefined reference to `cufftExecZ2Z'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:108: undefined reference to `cufftDestroy'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:111: undefined reference to `cufftPlan1d'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:117: undefined reference to `cufftExecZ2Z'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:136: undefined reference to `cufftDestroy'
collect2: error: ld returned 1 exit status
make: *** [cufft_double] Error 1
16:56:27 Build Finished (took 2s.792ms)
i tried to set library path but in preferences windows i read "no CUDA-compatible devices detected"
please help me!
Best reguards
marco
now i can build source code but my program not work!
i read this error:
modprobe: ERROR: could not insert 'nvidia_331_uvm': Invalid argument
and i receive a message programmed by me if "cudaGetLastError() != cudaSuccess"
after "cudaMalloc"
For best clarification i read "cuda error: allocazione fallita" for this frame of code:
cudaMalloc((void**)&out_device, sizeof(cufftDoubleComplex)*NX*BATCH);
if (cudaGetLastError() != cudaSuccess){
printf("Cuda error: allocazione fallita\n");
return 0;
};
Run these commands in sequence:
sudo apt-get remove --purge nvidia-*
sudo apt-get install cuda-drivers
sudo apt-get install nvidia-nsight
Restart the machine and open nsight and look at the properties whether you see the detected driver.

clang++ Error when compiling the Minko engine SDK for HTML 5

I have followed all steps mentioned in Compiling the SDK for HTML5 to compile the Minko framework to HTML5.
When I run the batch file build_html5.bat, i have this error
000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
clang++.exe: error: clang frontend command failed with exit code 255 (use -v to see invocation)
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
mingw32-make1: *** [obj/html5/release/Picking.o] Error 1
mingw32-make: *** [minko-framework] Error 2
Here is my Emscripten conf :
LLVM_ROOT='C:/Program Files/Emscripten/clang/e1.30.0_64bit'
EMSCRIPTEN_NATIVE_OPTIMIZER='C:/Program
Files/Emscripten/clang/e1.30.0_64bit/optimizer.exe'
NODE_JS='C:/Program Files/Emscripten/node/0.12.2_64bit/node.exe'
PYTHON='C:/Program Files/Emscripten/python/2.7.5.3_64bit/python.exe'
EMSCRIPTEN_ROOT='C:/Program Files/Emscripten/emscripten/1.30.0'
MINGW_ROOT='C:/Program Files/Emscripten/mingw/4.6.2_32bit'
JAVA='C:/Program Files/Emscripten/java/7.45_64bit/bin/java.exe'
Im on windows 7 64 bit.
Anyone know what causes this error and how can I resolve it?
This is a known problem with Emscripten 1.30, it should be resolved in future versions. For the moment, stick to Emscripten 1.29.

Error when building for IOS

I am having the following error when building for ios
ld: file too small (length=0) file '/Users/………./.robovm/cache/ios/x86/default/Users/ ……/.m2/repository/org/robovm/robovm-dist/0.0.13/unpacked/robovm-0.0.13/lib/robovm- rt.jar/java/nio/PipeImpl$PipeSinkChannel.class.o' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
:ios:launchIPhoneSimulator FAILED
FAILURE: Build failed with an exception.
Any ideas? The desktop configuration is working. The JDK is 1.7+
I have installed the latest gradle setup for libgdx
Thanks
See for solution here: https://github.com/robovm/robovm/issues/238
You need to remove zero-length class from cache and run build again.

cocos2d-x android compile ERROR

I can run my code in vc2012.
I need to compile my code to android so I use linux system to run ./build_native.sh
. Then terminal turn out this
StaticLibrary : libchipmunk.a
Compile thumb : cpufeatures <= cpu-features.c
StaticLibrary : libcpufeatures.a
SharedLibrary : libgame.so
/myData/Data/JAVA/adt-bundle-linux-x86_64-20130717/android-ndk-r8e/toolchains/arm-linux- androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux- androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/game_shared/__/__/Classes/AppDelegate.o: in function AppDelegate::applicationDidFinishLaunching():jni/../../Classes/AppDelegate.cpp:29: error: undefined reference to 'CPWScene::createScene()'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libgame.so] Error 1
make: Leaving directory `/myData/Workspace/C++/cocos2d-2.1rc0-x-2.1.3/Workspace/ClassDesgin/proj.android'
You have to add CPWScene.cpp file to Android.mk file so that compiler can compile the file. Android.mk file is located in proj.android/jni folder. In order to compile your project you need to list all your cpp files in Android.mk file.

pycuda -- error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1

i installed sabayon linux and i tried to install pycuda but i am receiving the following error when i try
su -c "make install"
In file included from src/cpp/cuda.cpp:1:0: src/cpp/cuda.hpp:12:18:
fatal error: cuda.h: No such file or directory compilation terminated.
error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1
I must mention that i can compile with cuda.
The same happens and when i try with
sudo -E sh -c "make install"
My .bashrc is :
# Put your fun stuff here.
export PATH=~/bin:$PATH
export PATH=$PATH:$HOME/Matlab_2010b/bin
export PATH=/opt/cuda/bin:$PATH
export LD_LIBRARY_PATH=/opt/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_ROOT=/opt/cuda/bin
(When i do echo $PATH as user it shows me : /opt/cuda/bin but when i try it as root it doesn't show anything and i had to do export PATH...again in order to show.)
You have CUDA installed in a non-standard path and the PyCUDA installer doesn't know how to find the toolkit headers it needs to compile. As per the installation instructions, you need to do something like this:
python configure.py --cuda-root=/opt/cuda
then
su -c "make install"
this will ensure that the compilation can find the necessary driver API headers to build the support libraries and hardcode all the right paths into the PyCUDA python libraries so that everything works correctly.