Cocos2d-x C++ build error on Eclipse ADT - c++

I'm newbie of Cocos2d-x C++. I tried to run then debug the sample code HelloCpp of cocos2d-x 2.2.1 on my Mac. The following is what I did:
1 . Set environment variables: NDK_TOOLCHAIN_VERSION, NDK_ROOT, ANDROID_SDK_ROOT, COCOS2DX_ROOT, ...
I can run build_native.sh from Terminal without errors.
2 . Add C++ classes to project
HelloCpp is a C++ project already so I ignored converting this project to C/C++ project in Eclipse.
C++ classes added to project successfully.
3 . Change the project settings to specify how to run make command
In My project -> Properties -> C/C++ Build -> Builder Setting:
Set "Build command" = /bin/bash ${ProjDirPath}/build_native.sh NDK_DEBUG=1 V=1
In My project -> Properties -> C/C++ Build -> Builder Setting -> Tool Chain Editor:
Set "Current toolchain" = Android GCC
Set "Current builder" = Gnu Make Builder
4 . Run project as an Android Application. I got these errors:
.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 68: mkdir: command not found
.../ADT/adt-bundle-mac-x86_64-20130917/android-ndk-r9b//ndk-build: line 40: dirname: command not found
.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 33: dirname: command not found
.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 52: dirname: command not found
.../ADT/adt-bundle-mac-x86_64-20130917/android-ndk-r9b//ndk-build: line 132: uname: command not found
I searched a lot but cannot resolved errors. I was wrong somewhere. Thank you for your help.

I've listed all the possibilities to cause error while building cocos2d-x in eclipse here in my blog. Hope it helps you. Let me know if it still doesn't fix your issue.

There is a README.md document in 'yourproject/proj.android' folder, it will help you build your project in eclipse.

Related

Trying to build mysql-connector-cpp on Windows

I want to be able to build mysql-connector/c++ applications in debug mode (VS2k17), and understand the only way I can do that is to first build mysql-connector-cpp from source on my computer (Windows 10/64bit). I tried the following:
cmake . -DWITH_SSL=C:\Users\Rawb\source\libraries\OpenSSL-Win64
and it looks to complete successfully ...
Install location: C:/Users/Rawb/MySQL/MySQL Connector C++ 8.0
Connector libraries will be installed at: lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Rawb/source/repos/mcc2/mysql-connector-cpp
but when I run the following cmake build ...
cmake --build . --config
it fails with this output ...
LINK : fatal error LNK1104: cannot open file 'ssleay32.lib' [C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj]
Done Building Project "C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\ALL_BUILD.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj" (default target) (10) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'ssleay32.lib' [C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:14.57
What might I be doing wrong? Do I just need to place the ssleay32.lib file somewhere? I do have a copy of it but not sure how it should be included. Or is it more complex? I.e. Do I need to build Open SSL first on my machine as well? This is a deep rabbit hole for me, I may be in over my head haha!
NOTE: I also asked this question on reddit with no luck, so hoping someone here might know.
If you're using MSVS (any version, including MSVS 2017), then I'd suggest using "NMake" (instead of cmake). Or just create a new C/C++ library project in the MSVS IDE.
The flag you're looking for is /LIBPATH. I don't think you need "-D", but you certainly need "/LIBPATH".
Here are the MSVS linker options:
https://learn.microsoft.com/en-us/cpp/build/reference/linker-options?view=vs-2017
Finally, you might be able to do all the troubleshooting/tracing you want without actually debugging (and rebuilding) the connector code.
Here's how to enable tracing in the MySQL Connector:
https://dev.mysql.com/doc/connector-cpp/1.1/en/connector-cpp-debug-tracing.html
Please let me know if this helps.

Codelite issue--No executable specified,use 'target exec

I have just installed codelite in my windows 8.1.It shows error
Debugger exited with the following error string:
"No executable
specified,use 'target exec'"
I searched and found this (another stackoverflow question) I did the same as mentioned there but nothing really worked for me.I made a new project and selected Simple executable (g++) and GNU debugger as default debugger.Can anybody help me with this.Also it shows "Program exited with return code: 4199040".
It seems that you don't provide executable to run/debug:
Go to
Project settings... -> Common settings -> General
and fill correct information for
Executable to Run / Debug
Jarod42 provided a 'close enough' answer. On Linux the steps seem to be:
Workspace -> Open Active Project Settings... -> General
and fill correct information for
Executable to Run / Debug
In the command prompt:
gdb (program type: example python or c or c++ etc)
If am running python program then the command will be gdb python
then (gdb) run program_name.py

wxWidgets-2.9.4\include and \lib\gcc_lib\mswu No such file or directory error on CodeBlocks

I'm trying to learn C++ programming with wxWidgets and CodeBlocks (with MinGW) and earlier today I succeeded in installing the software (after some trouble) to my Windows 7 computer with the guidance given to me in this post:
wxWidget 2.8.12 not working in Codeblocks
Later on the same day, I did the exact same steps on another Windows 7 machine and after creating a wxWidgets project and trying to compile and run it I got the following errors:
\wxWidgets-2.9.4\include: No such file or directory
\wxWidgets-2.9.4\lib\gcc_lib\mswu: No such file or directory
I have checked and these folders really do exist on those locations...so what seems to be the problem here again?...on the earlier post user asanth kumar guided me that if the steps given in the guide don't get the job done, then I'm missing an important compiler search path in my build options.
Ok, so what do I do? Where do I enter the search path? What is the search path, etc. I'm very new with wxWidgets and CodeBlocks so I don't know very much terminology. If anyone should know what to do, could you please give me like step by step instruction what to do e.g. like Click Project --> Build options --> ... and so on
I have used the latest CodeBlocks (12.11) and wxWidgets (2.9.4) installers
Thank you for any help :)
UPDATE:
here is the build log: (I'm using CodeBlocks 12.11 and wxWidgets 2.9.4)
-------------- Build: Debug in TEST (compiler: GNU GCC Compiler)---------------
windres.exe -I"C:\Users\Jonne\Omat ohjelmat\wxWidgets-2.9.4\include" -I"C:\Users\Jonne\Omat ohjelmat\wxWidgets-2.9.4\lib\gcc_lib\mswu" -J rc -O coff -i C:\Users\Jonne\DOCUME~1\CODEBL~1\TEST\resource.rc -o obj\Debug\resource.res
gcc: error: ohjelmat\wxWidgets-2.9.4\include: No such file or directory
gcc: error: ohjelmat\wxWidgets-2.9.4\lib\gcc_lib\mswu: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 0 warnings (0 minutes, 0 seconds)
Here is also a picture where you can see Build options, global variables and build log on my CodeBlocks:
NOTICE FUTURE READERS: Install wxWidgets to a directory without whitespace in the path name. The problems in this post was because the directory path had spaces in it
When you create a wxWidgets project.Have you did this?
File->New->Project->wxWidgets Project->Click Go->Click on Next->click on the suitable wxWidgets 2...version->click Next->Give project Name->Click on Next->Click on Next
After that the Following below Screen comes in the Wizard. Give the wxWidgets Location(Path where You installed the wxWidgets 2.9.4)
After that click on Finish.
For Environment Variable Path Setting
Follow the Below Steps:
Right click on MyComputer->Click on Advanced Systems settings->click on Environment Variables->click on New->Give variable name=Path and variable value="C:\Program Files (x86)\CodeBlocks\MinGW\bin" -> click ok
`
Try The Following Steps.It will work.
Updates about Build settings:
I am having the same problem as this and I somehow solved my problem.
I transfer my wxWidget folder to another location path that don't have white space name on it's path. For example above, "C:\Users\Jonne*Omat ohjelmat*\wxWidgets-2.9.4\include"
the path has white space between Omat ohjelmat. Try transfering it where the path contains no white spaces. For me, I put it on C:\wxWidgets-3.1.2

launch failed. Binary not found

I am trying to get eclipse set up to work with C++, however when I try to run a basic program I get the error: Launch failed. Binary not found
Also this prints to the console:
Configuration failed with error
(Cannot run program "sh": Launching failed)
This is the path that I have set:
C:\Program Files\Java\jdk1.7.0_01\bin;C:\msys\1.0\bin;C:\mingw\bin;
All help will be appreciated.
For Windows:
Project / Properties / C/C++ Build / Settings /Binary parsers:
Turn on "PE Windows Parser"
Then, build it (Ctrl+B) before running/debugging
project->build project

gdbinit "no such file or directory" Eclipse c

I'm using Xming to connect to a Linux (enterprise edition) server on which I'm trying to debug a C++ project in Eclipse Galileo. The following errors occurred:
Reading symbols from ../workspace/myfile ..(no debugging symbols found) ... done.
.gdbinit : No such file or directory
Setting environment variable "LS_COLORS " to null value
(.gdbinit is on the server (in root), my account has rights)
If i try to run gmake on the same file from the terminal I get the following error :
gmake ** No rule to make target /workspace/myfile' . Stop.
//I have exported the path (including the library path), and gmake exists.
My project has 3 subprojects (proj1 , proj2 and proj 3). In order to debug proj3 I have to build projs 1 and 2 . I created make targets for projects 1 and 2, and I obtained .so files for which i made softlinks to corresponding files in my_project/libs folder.
My Eclipse debug configuration is as follows (tab order):
Main
  Project: My Project
  Build Configuration: UseActive
  C++ Application: path to my project/myproject
  Environment: path to libs on server (my user rights)
Debugger
  Debugger: gdb/mi
  (Checked) Stop startup at main
  GDB debugger: gdb
  GDB command line .gdbinit
  GDB command set: standard
  Protocol mi
Project Properties:
  Builders CDT Builder
  Scanner Configuration Builder
  C/C++ Build
  Build command gmake -k
Behaviour
  build incremental build : all ( sometimes i get the error no rule for make all)
  Clean: clean
  Discovery options:
    (Checked) Automatic discovery path
    (checked) Report path detection problems
    Discovery profile GCC per project
    (checked ) Enable build output
    Compile invocation comand gcc
    Toolchain
    No toolchain
    Correct builder GNU make builder
This Eclipse debug configuration works on another account (on the same server using the same Eclipse). The gdbinit and gmake files are on the server and work, I'm not supposed to update the versions (this was one solution I found online).
Has anyone seen this error before? Does anyone have a clue what I'm doing wrong?