SOLVED: difference C vs C++ for importing simple function

About Monkey 2 Forums Monkey 2 Programming Help SOLVED: difference C vs C++ for importing simple function

This topic contains 1 reply, has 1 voice, and was last updated by  abakobo 2 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7144

    abakobo
    Participant

    I’ve trouble with the difference with c and c++

    I’ve copied some C example code from the net to be sure i’m using real C style. http://gribblelab.org/CBootcamp/12_Compiling_linking_Makefile_header_files.html (at the half page)
    It works if I put the content of the .c file in a .cpp file.

    What’s wrong there? I know chipmunk is in C but it’s first .h .c files are so complex that I can’t find what makes it ok to be in the .c format!
    (a zip file with all files is attached)

    I get the following error when importing the .c file:

    [/crayon]

    The files
    prime.monkey2:

    [/crayon]

    primes.h

    [/crayon]

    primes.c or primes.cpp

    [/crayon]

    I’ve tried with #include “prime.h” in the .c file but same problem..

    Attachments:
    1. prime.zip
    #7146

    abakobo
    Participant

    Solved:
    Adding this at the beginning of files

    [/crayon]

    and this at the end

    [/crayon]

    And I can now switch the .c and .cpp files.
    Looks like mx2 is cpp by default..

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.