Im new to uvision and programming and im looking at a project that has some headers as, #include "..\..\..\swim\lpc_types.h". How do i give it the correct path to the file?..how is "..\..\..\" supposed to define a path?, ive only seen headers included like #include lpc_types.h
It's just the standard notation for a relative path - same as you'd type on a command line.
The question is, of course, relative to what...?
"ive only seen headers included like #include lpc_types.h"
That is also a relative path - it doesn't state what folder and drive to look in.
It's just the standard notation for a relative path
Do you mean the dots? Because the backslashes don't look that standard to me. I prefer to use forward slashes most of the time.
Because the backslashes don't look that standard to me.
It's a Microsoft thing.
www.teamits.com/.../slashes.html
It's a Microsoft thing
Yes, it is. But the article you are linking to contains some questionable information. Who knows what else is wrong there?
Unix systems, on the other hand, use the forward slash to indicate folder names. Users commonly see this in web site addresses, since the vast majority of web servers run some form of Unix.
Forward slashes in URL's are used because the standard (www.rfc-editor.org/.../rfc1738.txt and other RFC's that supersede it) mandates this. The fact that many web servers run on Unix is just a coincidence.
But the article you are linking to contains some questionable information.
That was just the first think that showed up on my google search as an example.
Really, I was just suggesting that an application designed to operate under a Microsoft operating system (such as the Keil uVision suite) is likely to use the backslash and being surprised of that use is a surprise.
@Mike Kleshov To my limited knowledge, I think Keil toolchains can only run on Windows OS. I never try to run uVision on other OS, so I can't tell... As for backslashes in Dos/Windows, which have been used for years.
Where have you been?!
Every 'C' compiler I've ever used has allowed forward slashes as path element separators - even on DOS/Win systems.
You could use the "proper" back-slashes, but that gets messy - as the backslash is the "escape" character in 'C':
#include <..\\somefolder\\someheader.h>
It seems that we are confusing what's used by the underlying OS (backslashes for DOS/Win; forward slashes for *nix) with what may be used "internally" by applications running on those systems; eg, compilers & webservers.
As the 'C' standard says,
"There shall be an implementation-defined mapping between the delimited sequence [in the #include directive] and the external source file name"
In the case of all the compilers I've used, that "mapping" has included converting forward slashes to backslashes on DOS/Win systems...
Any sane implementation should support '/' to allow compatible transfer of source code.
Then the implementations also normally have support for the native path format. But that is something that we better avoid using.
Forward slashes are fine in the code and you're right "..\.." is the same as "....", which of course doesn't make sense. So using "../.." is more convenient.
However don't use / in the .uvproj files. Instead use a single \ there. That's of course only relevant if you happen to generate parts of the .uvproj from your code, like I do, or manually edit it. µVision accepts / in the .uvproj, but relative includes (even those in the same directory) don't work any more. Took me quite some time to find out.
Should've read the entire thread before posting. That was slightly redundant.
View all questions in Keil forum