Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to fix a simple error in Atmel studio

I am programming an Atmega chip using Atmel studio 7. I try to define F_CPU on the first line of the main.c file. This F_CPU definition is used inside the other files. However when I compile the program the F_CPU symbol definition can’t be seen by other files and the compiler throws the error shown in the picture.
Thanks

The picture showing the error…
[enter image description here]

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Your #define is only visible in the main.c file. It is not defined in any other source files in your project.

What you should do:

define F_CPU in the project properties.

Right click project > Properties > Toolchain > AVR/GNU C++ Compiler > Symbols
Configuration: All Configurations
Under "Defined symbols", add F_CPU=8000000UL

from now on your F_CPU will be visible be all files in your project.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading