C++ Include Files?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have just started using AVR Studio (Ver 6) for C++ programs.

 

I am having a problem with include files. The files show in the project window but compiler says they don't exist.

 

What must you do to use include (.h) files with this C++ compiler?

 

Bob Macklin

Seattle, Wa

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cklinbob wrote:
I have just started using AVR Studio (Ver 6)

Why have you started with v6 ??

 

v6 was superseded by v7 several years ago!

 

The files show in the project window but compiler says they don't exist.

You use the 'Include Path' to tell the compiler (or, to be pedantic, the preprocessor) where to find include files.

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cklinbob wrote:
I have just started using AVR Studio (Ver 6) for C++ programs.

 

I am having a problem with include files. The files show in the project window but compiler says they don't exist.

 

What must you do to use include (.h) files with this C++ compiler?

 

Bob Macklin

Seattle, Wa

Welcome to AVRFreaks Bob.

 

Atmel Studio, not AVR Studio, is at version 7 now, you should uninstall AS6 and install AS7 instead.

 

How have you tried to include the .h files?

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am still running WinXP. When I tried version 7 it would not run on XP.

 

I have my include files (.h) in the same directory as the main program.

 

Where do I set the path to the include files?

 

I have been a C++ programmer since 1989. Since 1998 I mostly used Microsoft VC++

 

I have been programming the Atmel chips in assembly language since about 2005. I previously use version 4 and 5 for assembly.

 

I recently upgraded to version 6.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cklinbob wrote:
Since 1998 I mostly used Microsoft VC++

Atmel Studio is built on Visual Studio - you should recognise it!

 

Where do I set the path to the include files?

In the Project Proerties > AVR/GNU C++ Compiler > Directories

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GOT IT!

 

Thanks for the help!

 

Bob Macklin

Seattle, Wa

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the header files are in the same directory as main() they should just be found if you #include "name.h"