Atmel Studio 7 : using avr/delay.h header file is giving warning - atmelstudio

I am working on a white line follower code in atmel studio 7 and added a lcd.c file to display the sensed values for white line. The header files used are
<avr/io.h>
<avr/delay.h>
<util/delay.h>
in both the main file and lcd file.
when i compile this code, i get a warning as :
this file has been moved to util/delay.h
the code is perfectly fine.
when i tried to build this project, i get some errors like,
Error : multiple definition of 'lcd_set_4bit'
Error: Disabling relaxation: it will not work with multiple definitions
warning: "This file has been moved to <util/delay.h>. [-Wcpp]"
Error: multiple definition of 'lcd_wr_command' in file delay.h
Error: multiple definition of 'lcd_init' in file delay.h
Error: multiple definition of 'lcd_wr_char' in file delay.h
Error: multiple definition of 'lcd_home' in file delay.h
Error: multiple definition of 'lcd_string' in file delay.h
Error: multiple definition of 'lcd_cursor' in file delay.h
Error: multiple definition of 'lcd_print' in file delay.h
Error: recipe for target 'project6.elf' failed
Error: ld returned 1 exit status
please somebody help me get rid of this problem.

The function declarations and definitions must be in separate .h/.c files for Atmel Studio. At least, that fixed this error for me.

Related

Visual studio generating corrupt (or maybe empty) library file

This was all working a few days ago. Not sure what changed.
I have a bunch of 32 bit library files which I am building on Windows 10 with VS2019. When I try to link with them, I get an error saying that the library file is corrupt. I've tried rebuilding, repairing visual studio, and rebooting.
1>CVTRES : fatal error CVT1107: 'C:\sandbox\debug\WinIPC.lib' is corrupt
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
Looking at one particular library, it is 40 megs in size which seems reasonable. Dumpbin /all, however, shows this
File Type: COFF OBJECT
FILE HEADER VALUES
0 machine (Unknown)
0 number of sections
0 time date stamp
0 file pointer to symbol table
0 number of symbols
0 size of optional header
0 characteristics
Summary
I have four library files that show this problem and several that don't. I don't see any difference in the way that they are built.
I do see from the dumpbin output that the libraries that don't work are file type "COFF OBJECT" while the ones which do work are "Library"
In the release build, visual studio does NOT complain about the file being corrupt, but it does complain about the symbols that should be in the library being unresolved, and dumpbin still shows that the file is empty.
Anyone have any suggestions?

clang-tidy displays errors in system headers

I'm trying to run clang-tidy on my IAR project, but I would like to ignore system header files. I tried the solutions provided here but they didn't work (read on for the results). Here's my project structure:
Proj
----Src
----Inc
SysHdrs
And this is my clang-tidy command from inside Proj:
clang-tidy.exe Src/*.c -header-filter=Proj\\Inc\\.* -checks=* -- -I"abs/path/to/Proj/Inc" -isystem"abs/path/to/SysHdrs"
I'm getting warnings on my Src files, as well as on some SysHdrs files such as SysHdrs/DLib_Defaults.h and SysHdrs/yvals.h. For example:
abs/path/to/SysHdrs/DLib_Defaults.h:563:6: error: "Compiler must support __weak" [clang-diagnostic-error]
#error "Compiler must support __weak"
^
abs/path/to/SysHdrs/yvals.h:37:4: error: "DLib compiled with wrong (version of IAR) compiler" [clang-diagnostic-error]
#error "DLib compiled with wrong (version of IAR) compiler"
^
abs/path/to/SysHdrs/yvals.h:232:11: error: unknown type name '__WCHAR_T_TYPE__' [clang-diagnostic-error]
typedef __WCHAR_T_TYPE__ _Wchart;
abs/path/to/SysHdrs/yvals.h:358:3: error: expected identifier or '(' [clang-diagnostic-error]
__WEAK __ATTRIBUTES void __iar_Locksyslock_Malloc(void);
^
Note that I do need to supply the system headers to clang, because otherwise it'd complain about a missing stdio.h / string.h etc.
As far as I know the -header-filter should filter out whatever doesn't match the regex pattern, so my system headers shouldn't be included in the outuput. Further, I've explicitly set the SysHdrs as "system headers" by using the -isystem identifier.
I even tried -header-filter=main\.h and it still processes the system headers.
Anything else I can try?

TFS 2017, build failing because of ssrs project into the solution

I am creating build for solution which has 2 projects (ssis,ssrs and SSAS) i am getting below error. I think this is because of SSRS in the solution. I have taken VS build and passed MSBuild arguremnts: /ignore:.dtproj,.rptproj
Error messages:
Source\Main\BI\Advocaten.BI\SSRS Advocaten\SSRS Advocaten.rptproj(68):Source\Main\BI\Advocaten.BI\SSRS Advocaten\SSRS Advocaten.rptproj(68,11): Error MSB4226: The imported project "O:\Microsoft Visual Studio\MSBuild\Reporting Services\Microsoft.ReportingServices.MSBuilder.targets" was not found. Also, tried to find "Reporting Services\Microsoft.ReportingServices.MSBuilder.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "O:\Microsoft Visual Studio\MSBuild\15.0\Bin\msbuild.exe.Config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.
Source\Main\BI\Advocaten.BI\SSIS Advocaten\SSIS Advocaten.dtproj(3):Source\Main\BI\Advocaten.BI\SSIS Advocaten\SSIS Advocaten.dtproj(3,3): Error MSB4067: The element <DeploymentModel> beneath element <Project> is unrecognized.
Process 'msbuild.exe' exited with code '1'.
Source\Main\BI\Advocaten.BI\SSIS Advocaten\SSIS Advocaten.dtproj(3):Source\Main\BI\Advocaten.BI\SSIS Advocaten\SSIS Advocaten.dtproj(3,3): Error MSB4067: The element <DeploymentModel> beneath element <Project> is unrecognized.
C:\Program Files (x86)\MSBuild\Business Intelligence Semantic Model\1.0\Microsoft.AnalysisServices.VSHostBuilder.targets(71):C:\Program Files (x86)\MSBuild\Business Intelligence Semantic Model\1.0\Microsoft.AnalysisServices.VSHostBuilder.targets(71,7): Error MSB4062: The "Microsoft.AnalysisServices.VSHostBuilder.SemanticModelGetOutputFilesTask" task could not be loaded from the assembly O:\Microsoft Visual Studio\MSBuild\Business Intelligence Semantic Model\1.0\Microsoft.AnalysisServices.VSHostBuilder.dll. Could not load file or assembly 'file:///O:\Microsoft Visual Studio\MSBuild\Business Intelligence Semantic Model\1.0\Microsoft.AnalysisServices.VSHostBuilder.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Source\Main\BI\Advocaten.BI\SSRS Advocaten\SSRS Advocaten.rptproj(68):Source\Main\BI\Advocaten.BI\SSRS Advocaten\SSRS Advocaten.rptproj(68,11): Error MSB4226: The imported project "O:\Microsoft Visual Studio\MSBuild\Reporting Services\Microsoft.ReportingServices.MSBuilder.targets" was not found. Also, tried to find "Reporting Services\Microsoft.ReportingServices.MSBuilder.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "O:\Microsoft Visual Studio\MSBuild\15.0\Bin\msbuild.exe.Config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.
Process 'msbuild.exe' exited with code '1'.

error: CvANN_MLP does not name a type

I am compiling my program in opencv-3.1, but I am getting following error
error: `CvANN_MLP` does not name a type
The program is compiling properly in opencv-2.4.
I am not able to find CvANN_MLP word in any of the opencv-3.1 header files.
Can anybody tell what is the problem ?
According to Upgrade guide it was changed from CvANN_MLP to cv::ml::ANN_MLP in 3.0.

What would cause a compiler to fail randomly?

I am using the clang compiler on windows. I used the installer from the LLVM website. Sometimes it gives me a compiler error.
clang -I./include main.c CoreFoundation.dll
it gives:
In file included from main.c:4:
In file included from ./include\CoreFoundation/CFNumberFormatter.h:110:
./include\CoreFoundation/CFXMLParser.h:159:81: error: unknown type name 'CFXMLNodeRef'
typedef void * (*CFXMLParserCreateXMLStructureCallBack)(CFXMLParserRef parser,
CFXMLNodeRef nodeDesc, void *info);
...
and sometimes this..
In file included from main.c:4:
In file included from ./include\CoreFoundation/CoreFoundation.h:86:
./include\CoreFoundation/CFDateFormatter.h:104:105: error: unknown type name 'CFDateRef'; did you mean 'CFDataRef'?
CFStringRef CFDateFormatterCreateStringWithDate(CFAllocatorRef allocator, CFDateFormatterRef formatter, CFDateRef date) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
...
...and other similar warnings, seemingly randomly choosing where to stop. Sometimes it compiles through without error. When it gives an error, they seem to be be about not finding a symbol from an included file. It doesn't complain about not finding the file. But it doesn't consistently stop at the same point and sometimes compiles successfully.
I can reproduce this "error" under Linux with gcc. I even get the "report this compiler bug pls" message.
When it gives an error, they seem to be be about not finding a symbol from an included file
You can get this:
if you compile with multiple threads (eg. make -j8)
if you abort the compile and then start it again without "cleaning" all obj files
if you compiled your source, changed something and compile without "cleaning"
if your compiler/make/build process changes the order every time... (had this with cmake and opencv 3 source)

Resources