Sysprogs forums › Forums › VisualGDB › Compile *.c files as C++ (Using IAR)
- This topic has 7 replies, 3 voices, and was last updated 4 years, 5 months ago by support.
-
AuthorPosts
-
April 19, 2020 at 14:20 #27901isigorParticipant
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
April 19, 2020 at 21:01 #27902supportKeymasterHi,
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.
April 21, 2020 at 08:27 #27921isigorParticipantThank you very much 🙂
July 1, 2020 at 04:52 #28635aelmicroParticipantHad 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 failedJuly 1, 2020 at 04:53 #28636July 1, 2020 at 05:09 #28638aelmicroParticipantOK 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
July 1, 2020 at 05:37 #28639aelmicroParticipanthands 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!
July 1, 2020 at 08:50 #28640supportKeymasterGood 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.
-
AuthorPosts
- You must be logged in to reply to this topic.