Compile *.c files as C++ (Using IAR)

Sysprogs forums Forums VisualGDB Compile *.c files as C++ (Using IAR)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #27901
    isigor
    Participant

    I’m trying your product, to use VisualGDB with IAR

    My current project consist c files and c++ files mixed together, some c header files include c++ headers,

    Compiling this under IAR IDE, on Language 1 tab->Language C++ works fine :), (that because IAR treats all files as c++ files)

    Compling this under VisualGDB with IAR doesn’t work 🙁

    only if I change extension to .cpp it will compile, but I don’t want that, because it’s a C file (the c++ include header file make the errors)

    You don’t have the option like in Visual studio compile as C++ file,

    I saw in one of your topics mentioning about “-x c” flag  in CXXFLAGS. (compile C++ as C) but I couldn’t find the opposite (compile C as C++)

    Any help will be appreciated

    Best regards

    Igor

    #27902
    support
    Keymaster

    Hi,

    No problem, please try this build: VisualGDB-5.5.5.3574.msi

    We have added an option under VS Project Properties -> C/C++ -> Advanced that allows explicitly specifying the input language for the source files instead of having it auto-detected from the extension.

    #27921
    isigor
    Participant

    Thank you very much 🙂

    #28635
    aelmicro
    Participant

    Had this problem when I tried to add a .c file to my other 3 *.cpp files which all compile OK

    It appears to indicate no rule in the make file to compile the .c file, but there is one!

    C:\Projects\PixieBoards\Software\PixieLvLib => /tmp/VisualGDB/c/Projects/PixieBoards/Software/PixieLvLib: 6 files are up-to-date.
    make -f “VisualGDB/Debug/PixieLvLib.msbuild-mak” –no-print-directory
    mkdir -p VisualGDB/Debug/_4_/tmp/VisualGDB/c/Projects/PixieBoards/Software/Source VisualGDB/Debug
    make[1]: *** No rule to make target ‘/tmp/VisualGDB/c/Projects/PixieBoards/Software/PixieLvLib/../Source/PixieInfo.c’, needed by ‘VisualGDB/Debug/_4_/tmp/VisualGDB/c/Projects/PixieBoards/Software/Source/PixieInfo.o’. Stop.
    make: *** [VisualGDB/Debug/PixieLvLib.msbuild-mak:14: all] Error 2
    ————————————————————-
    Command exited with code 2
    Executable: make
    Arguments: -f “VisualGDB/Debug/PixieLvLib.msbuild-mak” –no-print-directory
    Directory: /tmp/VisualGDB/c/Projects/PixieBoards/Software/PixieLvLib
    Command-line action failed

    #28636
    aelmicro
    Participant

    Uploaded .mak file

    Attachments:
    You must be logged in to view attached files.
    #28638
    aelmicro
    Participant

    OK so I had some luck.

    This works if I copy the *.c file into the same directory as my other *.cpp files, which happens to be the same file as the project.

    It would appers that it can’t find a make rule if the source file is in a different folder to the project folder.

    Mark

     

    #28639
    aelmicro
    Participant

    hands up, my mistake, I was not copying all the source files to the compiling PC, all works as it should

    Keep up the good work!

     

    #28640
    support
    Keymaster

    Good to know it works. In case anyone else encounters the problem, you can configure the root source folder uploaded by VisualGDB as a part of the build via VisualGDB Project Properties -> Project Settings -> File Synchronization or define additional directories to transfer via VisualGDB Project Properties -> Synchronized Directories.

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