No Such File or directory

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


In my code I've included DS3231.h, as seen below, but when I compile, I get a No Such File or Directory.

 

  • The path is included in my tool chain directory
  • It's showing under libraries in solution explorer

 

	///////////Preprocessor Directives////////////////
	#include <Arduino.h>									//Arduino functions
	#include <SD.h>										//SD card library
	#include <SPI.h>									//Serial peripheral interface (SPI) library
	#include <avr/io.h>									//AVR device specific IO definitions
	#include <inttypes.h>									//This header file includes the exact-width integer definitions from <tt><stdint.h></tt>, and extends them with additional
	#include <util/delay.h>									//Convenience functions for busy-wait delay loops
	#include <DS3231.h>								

 

 

I took some screen shots, but its not letting me paste them in, so they are attached for your consideration. Any help or guidance you can provide would be greatly appreciated.

 

-Tim

 

Attachment(s): 

Tim Watson

Last Edited: Tue. Jan 18, 2022 - 02:32 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you include a custom library, you must put double quotes around the name rather than <>.  (Not that I've ever made that mistake or anything)

#include "DS3231.h"

Also, there's an "add attachments" button under the text editor if you want to add a screenshot.

 

Jarrod

 

Edit:  Sorry, I just saw your note about the path being included in the toolchain, so my solution may not be correct.

Last Edited: Tue. Jan 18, 2022 - 01:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I did try #include "DS3231.h", but I get the same message.

Tim Watson

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



I tried to include some screen shots, but it doesn't seem like thats possible here

It seems to have been broken again however copy and paste still works (photo of a part I'm looking for my Sunbeam toaster sad)

 

 

I usually put all my file in one project directory for the simple reason that I may have to hand everything over to a client.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I gave it another go, but still no luck pasting the screen shots in, so I've shared them as an attachment.

 

-Tim

Tim Watson

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

Just copied and pasted both above. wink

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Thank you! Any idea what I'm missing that's causing the compiler to hang?

 

Tim Watson

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

Sorry, unfortunately not sad It seems to find the other 2 library files SPI and SD?? Unless the DS3231.h is before the other 2 and the system crashes before looking for those other 2 files.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

directory "Hawking R3p2" has a space in it. As I recall, Studio has problems with directories or files with such names. Something about enclosing the full path in quotes or such?

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Thank you for the suggestion ka7ehk..I replaced the spaces with underscores, but the issue persists.

Tim Watson

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

It's more helpful if you give the "Output" data as a paste of the actual text rather than a PNG graphic. The interesting bits are those that are NOT seeing rather than those that we are!

 

On the line below "Invoking" where it actually runs avr-g++ I would like to see the -I's

 

Also you have specified them as relative paths but are they right (the right number of ".." at the start)? They will be searched relative to the location of Sketch.cpp. So is your ./include/ actually at ".." beneath Sketch.cpp ?

 

Another useful thing to do is switch to a command prompt and CD to the project directory and then give the "tree /f" command and paste the text output of that here - it will reveal the actual layout of .cpp and .h on your disk in that area. (you may need to "go up one", that is "cd .." and do it again if the output does not contain the tree under "include")

 

Ultimately ZIp the entire project directory and attach here and I'll tell you exactly what is wrong.

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

 

 

DJJ_41010 wrote:
When you include a custom library, you must put double quotes around the name rather than <>

That's not necessarily true.

 

https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html

 

The thing is that both

#include "DS3231.h"

and

#include <DS3231.h>

give only the name of the file - they say nothing about the location of that file.

 

You have to set up your Include Paths to tell the compiler where to find #included files:

 

See: https://www.avrfreaks.net/commen... for illustrated instructions

 

in summary:

 

 

EDIT

 

Note that the above is for a C project; in a C++ project, you get two separate entries - one for the C compiler, and one for C++:

 

(sorry, the image posting is broken again - see attachment)

 

EDIT 2

 

2nd attachment - annotated to highlight C and C++ options

 

 

Attachment(s): 

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...
Last Edited: Wed. Jan 19, 2022 - 09:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
give only the name of the file - they say nothing about the location of that file.
Well they do a bit. whether "" or <> is used influences where the preprocessor will look for the .h. For "", by default, it will only look in the same directory as the source file that does the #include whereas for <> it looks there but also, then, in the configured "system path" locations (which is the part of the compiler/library installation where things like stdlib.h, math.h and so on are located).

awneil wrote:
You have to set up your Include Paths to tell the compiler where to find #included files:
Oh boy how I would love to be able to paste pictures! But you must be seeing something different in #1 to what I am seeing?? He has a list of 7 directories.

 

Oh wait a minute, got it.... 

 

... the issue is that both "C" and "C++" have their own separate sections for "Directories". In #1 the list (including the "DS3231") are listed for the C compiler so it's set under the WRONG set of "Directories". Sketch.cpp is a C++ file not a C file.

 

EDIT: SNAP - you edited that at the same time!! ;-)

Last Edited: Tue. Jan 18, 2022 - 09:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Oh wait a minute, got it.... 

 

... the issue is that both "C" and "C++" have their own separate sections for "Directories".

 

Yes, I realised that in my edit - but, by then, the image paste had broken again.

 

frown

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

awneil wrote:
the image paste had broken again.
Oh well at least it isn't just Brian and I stuck out in the picture-less wilderness then!

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

Indeed. frown

 

It's intermittent - I managed to paste the 1st image into #12, but then couldn't paste the 2nd for the EDIT.

 

(and now it's still not working)

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

js wrote:
I usually put all my file in one project directory for the simple reason that I may have to hand everything over to a client.

They don't need to all be in a single directory for that - just so long as they're all under a common project "root" ...

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: 1

awneil wrote:

Indeed. frown

 

It's intermittent - I managed to paste the 1st image into #12, but then couldn't paste the 2nd for the EDIT.

 

(and now it's still not working)

Andy I have copy/pasted the two images... hopefully as you intended.

 

Ross

 

Ross McKenzie, Melbourne Australia

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

Thanks.

 

yes

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...