digitalmars.D.learn - Compile main and class source.
Hi, I am new to D. I have no experience any language background. I have main function calling class "ABC" and class "ABC". I save separately like main.d and classABC.d. When I compile "dmd main.d classABC.d", it says "main.d(45); Error: undefined identifier ABC". How can i solve it?
Jul 05 2013
On Friday, 5 July 2013 at 20:08:18 UTC, Jaehunt wrote:Hi, I am new to D. I have no experience any language background. I have main function calling class "ABC" and class "ABC". I save separately like main.d and classABC.d. When I compile "dmd main.d classABC.d", it says "main.d(45); Error: undefined identifier ABC". How can i solve it?Did you imported classABCd in main.d? Else it would be helpful if you post some code.
Jul 05 2013
How to import classABC? Here is my main.d import std.stdio, std.conv, std.exception, std.math, std.random; void main() { ABC a = new ABC( a, b, c, d); ABC b = new ABC( e, f, g, h); ABC sum = a.sum( b); writeln( a); writeln( b); writeln( sum); } }
Jul 05 2013
On Friday, 5 July 2013 at 20:22:08 UTC, Jaehunt wrote:How to import classABC? Here is my main.d import std.stdio, std.conv, std.exception, std.math, std.random; void main() { ABC a = new ABC( a, b, c, d); ABC b = new ABC( e, f, g, h); ABC sum = a.sum( b); writeln( a); writeln( b); writeln( sum); } }E.g. with import classABC;
Jul 05 2013
Thank you for replying. I added import classABC; on second line in main.d and compiled. Now it says main.d(2): Error:module classABC is in file 'classABC.d' which cannot be read.
Jul 05 2013
On Friday, 5 July 2013 at 20:29:54 UTC, Jaehunt wrote:Thank you for replying. I added import classABC; on second line in main.d and compiled. Now it says main.d(2): Error:module classABC is in file 'classABC.d' which cannot be read.File name was not 'classABC. Sorry! I SOLVED IT. THANKS A LOT
Jul 05 2013