digitalmars.D.learn - learning D. Experienced issue very quickly.
- Mark (26/26) Apr 18 2012 Yeah I bought the book recently and ran into an issue very
- Steven Schveighoffer (6/31) Apr 18 2012 This compiles and runs on my system.
- simendsjo (3/28) Apr 18 2012 Are you using the D1 compiler..? It works on dmd 2.057,8 and 9 at least.
- Mark (2/5) Apr 18 2012 look at that. it says D1. I downloaded both D1 and D2. Better get
- simendsjo (3/7) Apr 18 2012 It's an easy mistake to make - at least now that D refers to D2, while i...
- Mirko Pilger (1/2) Apr 18 2012 don't worry. you're not the first and not the last being confused by thi...
- bearophile (8/11) Apr 18 2012 You aren't an idiot, it's not your fault.
- Paul (14/18) Apr 18 2012 Mark I started a thread along this line of reasoning. In my case
- H. S. Teoh (6/24) Apr 18 2012 [...]
Yeah I bought the book recently and ran into an issue very quickly into it. But this error I keep getting keeps bugging me. Could really use an explanation on why its not compiling. Here is the code. /* Compute heights in centimeters for a range of heights expressed in feet and inches */ import std.stdio; void main() { // values unlikely to change soon immutable inchPerFoot = 12; immutable cmPerInch = 2.54; // loop'n write foreach (feet; 5 .. 7) { foreach (inches; 0 .. inchPerFoot) { writeln(feet, "'", inches, "''\t", (feet * inchPerFoot + inches) * cmPerInch); } } } Here is the error I keep getting every time I try to compile: (13): found '..' when expecting ')' (13): found ')' when expecting ';' following statement (14): found '..' when expecting ')' (14): found ')' when expecting ';' following statement
Apr 18 2012
On Wed, 18 Apr 2012 09:10:46 -0400, Mark <section91 yahoo.com> wrote:Yeah I bought the book recently and ran into an issue very quickly into it. But this error I keep getting keeps bugging me. Could really use an explanation on why its not compiling. Here is the code. /* Compute heights in centimeters for a range of heights expressed in feet and inches */ import std.stdio; void main() { // values unlikely to change soon immutable inchPerFoot = 12; immutable cmPerInch = 2.54; // loop'n write foreach (feet; 5 .. 7) { foreach (inches; 0 .. inchPerFoot) { writeln(feet, "'", inches, "''\t", (feet * inchPerFoot + inches) * cmPerInch); } } } Here is the error I keep getting every time I try to compile: (13): found '..' when expecting ')' (13): found ')' when expecting ';' following statement (14): found '..' when expecting ')' (14): found ')' when expecting ';' following statementThis compiles and runs on my system. Are you using D1? Please use the latest D (a.k.a D2) compiler. The book does *not* cover D1 at all. If you are, please give more detail (OS, which compiler you are using). -Steve
Apr 18 2012
On Wed, 18 Apr 2012 15:10:46 +0200, Mark <section91 yahoo.com> wrote:Yeah I bought the book recently and ran into an issue very quickly into it. But this error I keep getting keeps bugging me. Could really use an explanation on why its not compiling. Here is the code. /* Compute heights in centimeters for a range of heights expressed in feet and inches */ import std.stdio; void main() { // values unlikely to change soon immutable inchPerFoot = 12; immutable cmPerInch = 2.54; // loop'n write foreach (feet; 5 .. 7) { foreach (inches; 0 .. inchPerFoot) { writeln(feet, "'", inches, "''\t", (feet * inchPerFoot + inches) * cmPerInch); } } } Here is the error I keep getting every time I try to compile: (13): found '..' when expecting ')' (13): found ')' when expecting ';' following statement (14): found '..' when expecting ')' (14): found ')' when expecting ';' following statementAre you using the D1 compiler..? It works on dmd 2.057,8 and 9 at least. Just write dmd, and look at the top for the compiler version.
Apr 18 2012
Are you using the D1 compiler..? It works on dmd 2.057,8 and 9 at least. Just write dmd, and look at the top for the compiler version.look at that. it says D1. I downloaded both D1 and D2. Better get rid of D1 then. I feel like such an idiot. THank you for the help.
Apr 18 2012
On Wed, 18 Apr 2012 15:24:12 +0200, Mark <section91 yahoo.com> wrote:It's an easy mistake to make - at least now that D refers to D2, while it used to refer to D1 :)Are you using the D1 compiler..? It works on dmd 2.057,8 and 9 at least. Just write dmd, and look at the top for the compiler version.look at that. it says D1. I downloaded both D1 and D2. Better get rid of D1 then. I feel like such an idiot. THank you for the help.
Apr 18 2012
I feel like such an idiot.don't worry. you're not the first and not the last being confused by this.
Apr 18 2012
Mark:look at that. it says D1. I downloaded both D1 and D2. Better get rid of D1 then. I feel like such an idiot. THank you for the help.You aren't an idiot, it's not your fault. In some months D1 compilers will be buried deeply in some sites, so your problem will (mostly) stop happening to new people. Having a well debugged compiler is most important, but also such simple "packaging/access" issue shouldn't be ignored. Bye, bearophile
Apr 18 2012
On Wednesday, 18 April 2012 at 13:10:47 UTC, Mark wrote:Yeah I bought the book recently and ran into an issue very quickly into it. But this error I keep getting keeps bugging me. Could really use an explanation on why its not compiling. Here is the code.Mark I started a thread along this line of reasoning. In my case it was the other way around. I made sure I downloaded D2 but found a code snippet for D1 (I think). I'm starting to realize this is probably an issue with free examples, tutorials, etc. The code isn't posted with comments or context as how it will compile. If I ever start offering my code on the web I'm going to put in the first comment line of the source code what context it compiled and ran under. e.g. DMD v2.058/Phobos/Win32/etc. Then if some newbie slacker like us is looking at the code 2 years from now, he will have some idea of whether he should try it. And if it doesn't compile, he can say "well that example was v2.058/Win32 and this is V4.01/Linux64 that I am running." ....and not get frustrated.
Apr 18 2012
On Thu, Apr 19, 2012 at 12:51:21AM +0200, Paul wrote:On Wednesday, 18 April 2012 at 13:10:47 UTC, Mark wrote:[...] +1. This is a good suggestion. T -- It won't be covered in the book. The source code has to be useful for something, after all. -- Larry WallYeah I bought the book recently and ran into an issue very quickly into it. But this error I keep getting keeps bugging me. Could really use an explanation on why its not compiling. Here is the code.Mark I started a thread along this line of reasoning. In my case it was the other way around. I made sure I downloaded D2 but found a code snippet for D1 (I think). I'm starting to realize this is probably an issue with free examples, tutorials, etc. The code isn't posted with comments or context as how it will compile. If I ever start offering my code on the web I'm going to put in the first comment line of the source code what context it compiled and ran under. e.g. DMD v2.058/Phobos/Win32/etc. Then if some newbie slacker like us is looking at the code 2 years from now, he will have some idea of whether he should try it. And if it doesn't compile, he can say "well that example was v2.058/Win32 and this is V4.01/Linux64 that I am running." ....and not get frustrated.
Apr 18 2012