How to create C++ executable/project?

Sysprogs forums Forums VisualGDB How to create C++ executable/project?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #891
    Anonymous
    Participant

    Hi
    I am a noob to Android, Android .mk files and VisualGDB (1 day) so please forgive me.

    How do you create a C++ console executable? I have tried converted the VisualGDB wizard generated console program which is using a ‘C’ compiler to use a C++ compile with no success. I have looking in VisualGDB properties hoping the ‘make’ had options for which type of compiler to use but there is nothing there. I have found changing file extension from .c to .cc appears to go in the right direction but then the file is removed from the .mk file and generates an error “in function _start:crtbrand.c(.text+0x78): error: undefined reference to ‘main'”.

    So I tried changing my one file from .c to .cpp extension. This causes make.exe error “make.exe: *** No rule to make target `jni/UnitTestSimpleMath.c’, needed by `obj/local/armeabi-v7a/objs-debug/UnitTestSimpleMath/UnitTestSimpleMath.o’. Stop.”

    I created a static library using the VisualGDB wizard for GoogleTest (C++ code) and this compiles fine. Again I cannot see the difference between this project and my UnitTestSimpleMath executable project (only ‘C’ ATM –> want C++).

    Why does .cc files removed from the .mk while files ending in .c or .cpp added?

    #3353
    Illya
    Participant

    Ok managed to convert the simple ‘C’ to C++. Renamed my file have extension .cpp (.mk allows .c and .cpp as standard). The step I was missing was to clean the project so it remade the make part of the project. Now build compiles and can use classes etc.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.