digitalmars.D.learn - How to use classes from another d files
- Vinod K Chandran (37/37) Oct 22 2019 Hi all,
- Adam D. Ruppe (4/8) Oct 22 2019 did you compile with dmd -i or list both files on the dmd command
- Vinod K Chandran (4/12) Oct 22 2019 Thanks for the reply. Nope. I just typed this code in VS Code and
- =?UTF-8?Q?Ali_=c3=87ehreli?= (8/20) Oct 22 2019 That: The -i switch is the answer to your question in the other post
- Vinod K Chandran (4/25) Oct 24 2019 @Ali Çehreli,
- Daniel Kozak (5/18) Oct 22 2019 You should use dub. You will probably need it anyway in the future.
- Vinod K Chandran (3/22) Oct 24 2019 @Daniel Kozak,
- Vinod K Chandran (3/22) Oct 24 2019 Is there any tutorials related to using dub in d lang ?
- Arun Chandrasekaran (5/12) Oct 22 2019 What you are seeing is a linker error. Build it as follows:
- Vinod K Chandran (7/20) Oct 22 2019 Thanks a lot. But what if there is too many include files ? Say,
- Adam D. Ruppe (6/7) Oct 22 2019 The dmd -i thing will do that for you
- Vinod K Chandran (3/10) Oct 24 2019 @Adam D. Ruppe,
Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d" ```D class TestClass { int myIntVar ; string myStringVar ; this(int miv, string msv) { this.myIntVar = miv ; this.myStringVar = msv ; }//End this }//End Class ``` And i wrote my main function in another file named "caller.d". Both these files are in same folder. ```D import std.stdio ; void main() { import classFile ; TestClass tc = new TestClass(37, "Sample String") ; writeln(tc.myStringVar) ; tc.myIntVar = 45 ; writeln(tc.myIntVar) ; writeln("its over..") ; }//End main ``` This is the error message i got. ;------------------------------------------------ caller.obj(caller) Error 42: Symbol Undefined __D9classFile9TestClass6__ctorMFiAyaZCQBjQBc caller.obj(caller) Error 42: Symbol Undefined __D9classFile9TestClass7__ClassZ Error: linker exited with status 2 PS E:\OneDrive Folder\OneDrive\Programming\D Programming\Samples\Sample2>
Oct 22 2019
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d"did you compile with dmd -i or list both files on the dmd command line?
Oct 22 2019
On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:Thanks for the reply. Nope. I just typed this code in VS Code and hit the run button. Thats all. i think this cmd business will be difficult for me.Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d"did you compile with dmd -i or list both files on the dmd command line?
Oct 22 2019
On 10/22/2019 11:25 AM, Vinod K Chandran wrote:On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:That: The -i switch is the answer to your question in the other post ("what if there is too many include files").On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d"did you compile with dmd -i or list both files on the dmd command line?Thanks for the reply. Nope. I just typed this code in VS Code and hit the run button. Thats all.But not sufficient. :) IDEs like VS Code have a way of describing what your project involves. You need to add the two files to you "project". (I don't know the details for your IDE.)i think this cmd business will be difficult for me.Yes, IDEs make it convenient. Ali
Oct 22 2019
On Tuesday, 22 October 2019 at 18:33:32 UTC, Ali Çehreli wrote:On 10/22/2019 11:25 AM, Vinod K Chandran wrote:Ali Çehreli, Thanks for the detailed reply. I have tested with "dmd -i" and it worked.On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppewrote:Chandran wrote:[...]playing[...]command line? That: The -i switch is the answer to your question in the other post ("what if there is too many include files").[...]Thanks for the reply. Nope. I just typed this code in VS Codeand hitthe run button. Thats all.But not sufficient. :) IDEs like VS Code have a way of describing what your project involves. You need to add the two files to you "project". (I don't know the details for your IDE.)i think this cmd business will be difficult for me.Yes, IDEs make it convenient. Ali
Oct 24 2019
On Tue, Oct 22, 2019 at 8:30 PM Vinod K Chandran via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:You should use dub. You will probably need it anyway in the future. VS Code have nice plugins to work with D you can install D Language utility extension packOn Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:Thanks for the reply. Nope. I just typed this code in VS Code and hit the run button. Thats all. i think this cmd business will be difficult for me.Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d"did you compile with dmd -i or list both files on the dmd command line?
Oct 22 2019
On Tuesday, 22 October 2019 at 18:34:52 UTC, Daniel Kozak wrote:On Tue, Oct 22, 2019 at 8:30 PM Vinod K Chandran via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:Daniel Kozak, Thanks. Let me try it. :)On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:You should use dub. You will probably need it anyway in the future. VS Code have nice plugins to work with D you can install D Language utility extension packOn Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:Thanks for the reply. Nope. I just typed this code in VS Code and hit the run button. Thats all. i think this cmd business will be difficult for me.[...]did you compile with dmd -i or list both files on the dmd command line?
Oct 24 2019
On Thursday, 24 October 2019 at 10:19:23 UTC, Vinod K Chandran wrote:On Tuesday, 22 October 2019 at 18:34:52 UTC, Daniel Kozak wrote:Is there any tutorials related to using dub in d lang ?On Tue, Oct 22, 2019 at 8:30 PM Vinod K Chandran via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:Daniel Kozak, Thanks. Let me try it. :)On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:You should use dub. You will probably need it anyway in the future. VS Code have nice plugins to work with D you can install D Language utility extension pack[...]Thanks for the reply. Nope. I just typed this code in VS Code and hit the run button. Thats all. i think this cmd business will be difficult for me.
Oct 24 2019
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d" ```D class TestClass { [...]What you are seeing is a linker error. Build it as follows: dmd caller.d classFile.d Unrelated, first line of classFile.d needs be `module classFile`
Oct 22 2019
On Tuesday, 22 October 2019 at 17:40:11 UTC, Arun Chandrasekaran wrote:On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:Thanks a lot. But what if there is too many include files ? Say, i have 10 files to import in main file, Do i need to type all the file names in cmd ? Is there any dedicated ide in order to avoid this typing task ? I have tested it with Codeblocks, but didn't worked.Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d" ```D class TestClass { [...]What you are seeing is a linker error. Build it as follows: dmd caller.d classFile.d Unrelated, first line of classFile.d needs be `module classFile`
Oct 22 2019
On Tuesday, 22 October 2019 at 18:21:36 UTC, Vinod K Chandran wrote:But what if there is too many include files ?The dmd -i thing will do that for you dmd -i main.d and it will automatically find the others, assuming they are laid out so the module/import name matches the file name
Oct 22 2019
On Tuesday, 22 October 2019 at 18:31:17 UTC, Adam D. Ruppe wrote:On Tuesday, 22 October 2019 at 18:21:36 UTC, Vinod K Chandran wrote:Adam D. Ruppe, Thanks. It worked. :)But what if there is too many include files ?The dmd -i thing will do that for you dmd -i main.d and it will automatically find the others, assuming they are laid out so the module/import name matches the file name
Oct 24 2019