Dibor, you are using at the moment UEStudio 19 in toolbar/menu mode with traditional menus as I could see on the video.
Let me first describe section
[General] and what
.CPP = .C means and why I think it was not good to add this line to this section.
The help contains on tab
Index the list item
[General] Compiler Section. Double clicking on this index list item opens the associated help page. It contains at bottom the line:
The remaining optional keys are for example .CPP=.C and are explained in the [.EXT] section.
The link at end opens the help page
[.EXT] Compiler Section which explains the section
[.C] in WinAVR application configuration. This
EXECUTIVE section contains the instructions what to do with a single file according to its file extension on
Compile,
Build or
Rebuild all.
The WinAVR application configuration contains:
[.C]
Out = $In.o
ReleaseFlag = $(Optimization)
DebugFlag = -g -O0
Cmd0 = $(Compiler) $R $(COPT) -c -o $O $I
IncFiles = 1
CaseSensitive = 1
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.
Out means an output file should be created and the name of the output file is defined with
$In.o.
$In is a variable reference and its meaning can be read in comment block at top containing
$In- input name. So for a file like
13cm.cpp the variable
$In expands to
13cm and appended is the file extension
.o (object file).
The compilation from source file to object file is done with the flags for a release build or for a debug build.
For a release build the optimization flag as referenced with
$(Optimization) is defined by opening from menu
Project the
Project settings... dialog and clicking on tab
Settings on button
Compiler options and double clicking in section
C/C++ COMPILER OPTIONS on last item
Optimization to select the optimization level resulting in using
-O0 or
-O1 or
-O2 or
-O3 or
-Os. The
Compiler Options can be also opened by clicking in menu
Build on
Compiler options. The manual of gcc/g++ contains the description of the optimization flag
-O. The WinAVR application configuration contains in the sections
[Settings],
[SettingsInfo] and
[SettingsReps] a line starting with
Optimization = which defines this compiler specific option for easy configuration by the user via the
Compiler Options dialog.
For a debug build the optimization flags are defined fixed with
-g -O0 which means generate debug information and do not optimize the code which is standard for C/C++ compilers for a debug build.
Release or
Debug build is defined in
Project Settings dialog on tab
Settings in group
Build mode or with the selector on toolbar
Build. The directory into which the files are created during build process can be customized by clicking on button
Compiler options and define both at bottom of the the dialog window. The debug and release path the user enters here is interpreted as relative path to project directory as defined for the project as written in dialog window at bottom.
The last line with
Cmd0 defines the command line written into the
project.mak file generated by UEStudio for a
Build or
Rebuild all respectively is the command line executed by UEStudio on using
Compile to compile just the active source file to an object file.
$(Compiler) references the compiler option with name
Compiler. The user of the WinAVR application configuration can define in the
Compiler Options dialog in section
COMPILER OPTIONS which compiler executable to use:
avr-gcc as used usually for C files or
avr-g++ as used usually for C++ files. See also
What is the difference between g++ and gcc?
Well, most projects consist of only C source files or of only C++ source files. A mixed usage of C and C++ source files in a project is rare. So it is usually okay that all files of WinAVR project are compiled according to section
[.C] with the compiler set once by the user in the
Compiler Options dialog. However, I would have written into the WinAVR application configuration:
[.C]
Out = $In.o
ReleaseFlag = $(Optimization)
DebugFlag = -g -O0
Cmd0 = avr-gcc $R $(COPT) -c -o $O $I
IncFiles = 1
CaseSensitive = 1
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.
[.CPP]
Out = $In.o
ReleaseFlag = $(Optimization)
DebugFlag = -g -O0
Cmd0 = avr-g++ $R $(CPPOPT) -c -o $O $I
IncFiles = 1
CaseSensitive = 1
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.
Do you see the differences?
The compiler executable to use is defined fixed for C source code files as well as for C++ source code files. So the three lines starting with
Optimization = in the sections
[Settings],
[SettingsInfo] and
[SettingsReps] would be no longer needed and the user would not need anymore to select in compiler options which compiler to use for the project. And for C++ source code files the general C++ options as defined by variable
CPPOPT in section
[Variables] would be used instead of the general C options as defined by variable
COPT in same section. I think, whoever wrote this WinAVR application configuration used it only for C and not for C++.
$R references the flags as defined by
ReleaseFlag or by
DebugFlag in the
EXECUTIVE section according to build mode.
-c is a gcc/g++ option which means
compile input file to an object file.
-o is a gcc/g++ option to define name of output file of which name is specified next with
$O referencing output file name as defined with
Out in same section and being created in current directory which is either the configured debug or release directory and which is set by UEStudio on executing
mymake.exe in program files directory of UEStudio with the
project.mak file generated by UEStudio.
$I references the full qualified file name of the source code file to compile.
The other settings are explained in help and usually don't need to be modified for any C/C++ compiler.
But for reasons which I have never understood there are programmers which invent file extensions for their source files different to the standard *.c for C source files and *.cpp for C++ source files. For that reason the section
[General] contains a mapping list of file extension to
EXECUTIVE section.
Therefore the lines
Code: Select all
.ADS = .C
.ADB = .C
.C++ = .C
.CXX = .C
.CC = .C
.CP = .C
.JAVA = .C
.I = .C
.II = .C
.MI = .C
.S = .C
.F = .C
.FOR = .C
.FPP = .C
mean that all files with a file extension as written left to the equal sign should be processed with
EXECUTIVE section
[.C] as defined in the WinAVR configuration.
It can be seen here that this list was created based on Visual Studio configuration because I am quite sure that no C/C++ programmer for AVR controllers gives ever the C/C++ source files the file extension .ADB or .JAVA or .FOR (FORTRAN) although gcc supports also JAVA and FORTRAN compilation.
I think once again that the UEStudio user creating the WinAVR configuration has never really thought about C++ WinAVR projects or a WinAVR project with mixed C and C++ source files as otherwise the configuration would be really written as I wrote above with file extensions .C++, .CC, .CP assigned to
EXECUTIVE section
[.CPP] and variable
CPPOPT would be defined as set for
C++ COMPILER OPTIONS which make really sense and work for AVR controller compiled with
avr-g++.
The issue with wrong relative paths of the warnings output by
avr-gcc or
avr-g++ (can't see which compiler you have configured in compiler options) is not easy to reproduce by me with having WinAVR compiler not installed at all and not having your WinAVR configuration and project file.
Please pack into a 7-Zip, RAR or ZIP file archive file:
- WinAVR application configuration file as used by you now,
- the UEStudio project file trx_control.prj,
- the UEStudio project user interface file trx_control*.pui and
- the makefile trx_control.mak generated by UEStudio in subdirectory Debug of your project.
For the makefile click in menu
View in submenu
Views/lists in submenu
Toolbars on menu item
Build to make this toolbar visible. Then click on last item of toolbar
Build with tooltip
Commands to open a pop-up menu and click on last item
Show makefile to get this file opened in UEStudio. I am really wondering why the
Build toolbar was not yet enabled by you as this is the most important predefined toolbar in my opinion on working with an UEStudio project with a compiler configuration in toolbar/menu mode.
Your
(later deleted) video does not show any of the lines on which avr-gcc/avr-g++ output a warning. So I can't really recommend you an alternate code line to avoid these warnings.