Adding new file in AVRStudio 7 but compiler cant find it..

This one is killing me folks. I have been using visual studio for the best part of my career (read 20+ years) but I cannot for the life of me make this work.

So I started with a simple sketch that I imported into AVR studio. Few minor issues but I figured them out, and it all compiled and worked fine.

Then I use solution explorer to add a new header file. The header file exists, its in the correct directory (same as the original sketch), but when I include using #include <header.h> the compiler tells me that no such file or directory exists? What am I doing wrong? Is there some obscure place that I have to reference this file? When I had some issues importing the sketch, its seems that AVRStudio generates the make file each time you build, so I assume I dont need to touch that? (might be an invalid assumption though).

This is driving me mad.

Thanks folks. I shall keep looking in the mean time.

Is this really a Programming issue? I don't think so. You are NOT having a problem with programming for the Arduino.

PaulS:
Is this really a Programming issue? I don't think so. You are NOT having a problem with programming for the Arduino.

Suggestions on the correct forum are welcome.

I apologise if this is the wrong place, but chose this based on searching on google.

EDIT: Might I add. I am a programmer, and programming on arduino products, using AVR studio as an IDE. So I guess I am having an arduino programming issue.

So I guess I am having an arduino programming issue.

If the code compiles, links, and uploads using the IDE, you don't. You have an AVRStudio problem. This is NOT the AVRStudio forum.

PaulS:
If the code compiles, links, and uploads using the IDE, you don't. You have an AVRStudio problem. This is NOT the AVRStudio forum.

Your attitude sucks. I have noticed that also from other responses. Guys like you drive away experienced people from forums like this. I am using all Arduino hardware and libraries and using the same toolchain, so it is programming on the Arduino platform whether you like it or not. I chose to move over to Atmel Studio as the IDE because its more functional and I can use a debugger. This is a natural progression as people learn and discover the limitations of the Arduino IDE.

Anyway, hate to knock you of your pedestal, but I figured out that adding the path in Properties/Toolchain/Directories solves the problem. Seems that Atmel Studio has some issues, but I am sure they will figure it out.

This is regular C, C++ behaviour angles imply a System search, quotes imply a local search.
Once you leave the Arduino IDE you have to obey the language rules.

AS7 has all sorts of problems when parsing an INO file into a legal C++ file.
The Arduino IDE looks after forward declarations, library header paths, library build and library link.
The IDE is forgiving when you use quote or angle brackets.

If you ask AS7 to "add" an Arduino library, it will attempt to do the path, build, link steps for you.
If you just add a local header file to a project directory, AS7 does not do anything.

It is probably wiser to ask AS7 questions on AvrFreaks and Arduino IDE questions on this forum.
You will probably get answers either way. But you are more likely to suffer "opinions" when you use the less appropriate forum. Believe me, when Arduino first started "some" AvrFreaks were very dismissive.

David.

Thanks David.

I am not religious when it comes to platforms. I think Arduino IDE is great for what it was designed for. I am also a member over at AVRFreaks, but only posted a few questions a long time back. I did post the same question there.

I am well impressed with Arduino and the community support for it. Perhaps there is place here for Atmel Studio related questions outside of the 'programming' forum?

The header file exists, its in the correct directory (same as the original sketch), but when I include using #include <header.h>

If the header file is in the same directory as the sketch, shouldn't you used "header.h" instead of <header.h> ?
User search path vs "system" search path...

Doesn't "import sketch" create a completely new directory? Is the .h file actually getting copied to that?

Your attitude sucks.

Well, so does yours.

Seems that Atmel Studio has some issues,

This is NOT the place to discuss them. Take them to Atmel.

westfw:
If the header file is in the same directory as the sketch, shouldn't you used "header.h" instead of <header.h> ?
User search path vs "system" search path...

Doesn't "import sketch" create a completely new directory? Is the .h file actually getting copied to that?

I tried using double quotes, it makes no difference.

I did import the sketch, but I was adding a new header file using the IDE (solution explorer). The file is where it should be ( the same directory as the converted sketch). I think it pretty obvious to me now that the issue is with Atmel Studio not doing what I would expect VS would do. I am not unhappy, as a said before its way better than what I used to deal with in the early days.

Anyways, as I have discovered as a noob to the Arduino forum, that there is some animosity between Arduino forms and AVRFreaks, so I will leave it as that. Its a shame, because I feel we could all collectively learn from it.

I was intrigued. So I took an AS7 imported sketch. Added an H file to the sketch directory which just provided a Preprocessor #warning.

Using quotes worked fine. i.e. it searched the sketch directory.
Using angles failed. i.e. the header was not in the system search path.

What I found disturbing was that the AS7 import had ticked the "inhibit all warnings box"
Hence the #warning did not appear in the Build Output.

Hey-ho. AS7 can't parse forward declarations properly. Nor get file trees properly.
It is a bit of miracle that it works at all.

Incidentally, there is no animosity on the AvrFreaks Forum. Some years ago, there was some "intellectual snobbery" but not any more.

All the same, whatever Forum, it pays to be courteous and polite.

David.