Why is my header include file making the build fail? - header

I am trying to include the spi.h file in my project for an Arduino Due. I want to use Atmel Studio 6.2 since it offers me more flexibility and is frankly a much better IDE than the Arduino tool. I can sucessfully program the board using bossa.exe programming utility called from a batch file which communicates with the Arduino. This is the basic call from the batch file:
C:\"Program Files (x86)"\Arduino\hardware\tools\bossac.exe --port=%1 -U false -e -w -v -b %2 -R
Now the issue is, Atmel studio works just fine to program the board if code is left like this:
#include "sam.h"
int main(void)
{
/* Initialize the SAM system */
SystemInit();
while (1)
{
//TODO:: Please write your application code
}
}
BUT the minute I do this:
#include "spi.h"
the build fails...
spi.h: No such file or directory
BUT when I look in the solution explorer, I can see the sam.h file:
So whats going on here?
(EDIT: I forgot to show the sam.h file in the screen shot, but trust me, its in the folder called "Dependencies")

You are missing spi.h header file. Are you sure you have the file available in your machine?

#include "header.h" will look for the header file in the same directory as the file it is being included from (usually, the .c).
#include <header.h> will look for the header in the system-wide standard header include directory.
You can also add custom include search paths for your compiler. Verify that spi.h is available in a location your compiler is aware of!
I don't know the specifics of the IDE you are using, but "Dependencies" seems like a virtual collection of files, not a physical folder.

Related

Elixir/Erlang: Set permissions at time of open/write/mkdir?

I'm writing a few config files and directory structure from my Elixir/Erlang service, and want specific permissions on both the directories and files (rwxr-x---(750) and rw-r-----(640) respectively).Basically, I do not want any "other" accessibility on either).
For both consistency and performance reasons, I'd rather not do a write!/3 followed immediately by a chmod/2 every time. I thought maybe I'd need to do the open/2 to get this kind of flexibility. But though the permissions masks are documented in the module, they appear to only be used by the chmod/2. I looked in Erlang :file module to see if this was one of those (use Erlang modules instead), but did not find it there.
I've tried umask, which works fine when I'm running it via mix from the command line, but not when deployed through the build product buried in a systemd service. There I've tried to set both UMask=0027 or through the environment, but it just seemed to be ignored there. I'd really rather do the explicit set at create time than have a umask operation located elsewhere to get the effect though.
In Linux, file permissions are set either at create time with open with O_CREAT or using the chmod system call.
In Erlang, you have file:write_file_info to change the permissions, but when using the equivalent to O_CREAT (file:open), there's not a great deal of flexibility.
I did a quick search of the flag in the repository, and I think that the O_CREATE mode is fixed, you can see the lines here, where it's fixed to
#ifdef NO_UMASK
#define FILE_MODE 0644
#define DIR_MODE 0755
#else
#define FILE_MODE 0666
#define DIR_MODE 0777
#endif
however, umask is applied when creating files.
That being said, if the file is opened so much that the permissions check in a concern, maybe it's worth keeping it open (and thus needing only a single chmod)
Or you could set manually the permissions on the top directory of the config, if other is unable to read/traverse the top directory, it does not matter if deeper files could be read.

Make header file dependent on external project

I have an external project that unzips a bunch of header files to ${EXTERNAL_INSTALL_PATH}/extproj.
The problem is that I have no way of telling my various executable to build extproj beforehand unless I do add_dependencies(myapp extproj).
I have a lot of executables though, so that's a lot of add_dependencies!
Is there a way to just do something like:
add_dependencies(header_file.h extproj) such that any app that #include <header_file.h> automatically knows to build extproj?

Parent directory headers using Arduino

I have a few headers and source files which I want to be common between two sketches (as they are communication interfaces) but I can't include them in my sketches: this very arguable system of tabs refuses to find them when I use relative paths.
Example:
Project
-interface.h
-interface.cpp
-sketch1
--sketch1.ino
-sketch2
--sketch2.ino
I would like to do:
#include "../interface.h"
Without making a library out of it and putting it elsewhere (so as not to have to move around files when they are handed out to somebody else).
Thank you for your help (I'm growing mad over here ),
Mister Mystère
P.S: Version is 1.0.5 on Windows
The bad news is you probably have to place interface.h/c in a library folder. The good news is that it is not that difficult. Simply create a folder named "interface" as a peer to other library folders and cut/paste interface.h/c into that folder.
Finally, after creating the new folder/lib you will need to completely exit Arduino's IDE and restart it, before you can select a new "interface" lib for your sketch.
Create symbolic links to all of the required files.
Linux
ln -s sourcefile targetfile
Windows
mklink targetfile sourcefile

Running an Mac OS command line application, how to

Suppose you create a new Mac OS Command Line Application using Xcode, which prints something. How do you actually find and run it using your command line or Finder?
Application was "built", but project directory structure does not seem to contain an executable file. For what matter in what format will this file be?
Please advise
This should help out:
Choose to build your project for archiving (Product->Build
For->Archiving).
The executable will be created and placed in the project build
folder. This will typically be something like
/Users//Library/Developer/XCode/DerivedData//Build/Products/Release.
If you wish, copy the executable to a more convenient location.
To run it, open up a shell window, browse to the executable
directory, and type in your command name.
EDIT
I see you mentioned iOS in your question and tagged it as such. This answer is NOT relevant to iOS, infact I see no option to build a command line application for that system and it doesn't really make much sense to have one.

Build and Debug application outside the default package

If I try to build an application with the application class outside the default package, so the application file path is /app/AppClass.mxml instead of /AppClass.mxml (as would normally be the case), Flash builder cannot launch the application for debugging because it is looking for the SWF in debug/app/AppClass.swf and the SWF is being output to debug/AppClass.swf instead. Changing the output folder to debug/app makes it put the swf in debug/app, but then it puts the application configuration file "AppClass-app.xml" in /debug/app/app and then that can't be found.
Is there a way to change only the SWF output folder, or the location of the xml configuration file in the run-configuration?
You may use symbolic link to created swf file - http://en.wikipedia.org/wiki/Symbolic_link
for example for Windows :
cd project/path/bin-debug/package/path/
MKLINK ClassName.swf project/path/bin-debug/ClassName.swf
and it's work
or you can use symbolic link for folder:
cd project/path/bin-debug/package/
MKLINK path project/path/bin-debug/ /D
I think I remember this worked for me. But it was long time ago. And, yes, it is a known problem, I also recall Adobe people mentioning it as a limitation of FB.
In my Ant script, you'll need to do the adjustments to reflect your actual file names and directory structure. Also note that it will make it more cumbersome to debug it from FB. You'll need to use the debugging target in Ant, and then connect the debugger to the running application (so that some info, especially on the startup) will be lost. The only way you would be able to debug it, though I've never tried it, is with the commandline tools (I'm not sure of adl syntax for breakpoints / printing / stack frames, so idk how to do it.
Also, for the released application you will probably want to change the signing mechanism.