Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 02, 2004 Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Hi, In another thread I mentioned that I would convert my game to D. Well all was good until step 3 of 45672345. I looked at Walter's empire windows code and noticed that he wrapped the globals in a struct - so I did too. (This is when I decided that I had an issue with 'with'). Now here's where my lack of D savvy will show. When I went to refer to the struct in an other module I simply imported the module that the structure was declared in. It compiles but won't link. I get 'Error 42: Symbol Undefined _D4iced6globalS4iced7globals' in the importing obj module. I've tried every combination of export, extern I could think of; although I wouldn't have expected to need to. I also tried declaring the variable public, still no luck. Any thoughts would be appreciated. The structure definition and declaration are below. struct globals { int Score; bit Random; HDC hDCVid, hDCScrn, hDCMem; HINSTANCE Instant; HWND hWndStat, hWndEdit, hWndIce; char GameName[]; int Lives, Screen, Stands, CountDown, Diamonds, TimeOut, Loaded, xScr, yScr, yText, yChar, xChar, Width, Height; byte SCRNX, SCRNY, retX, retY, GoodX, GoodY, HIT; byte[64][64] Scrn; }; globals global; |
May 02, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Egan Attachments: | I dont think its a problem with the linker, maybe you have just overlooked something. Ive attached a simple example. Phill. "Scott Egan" <scotte@tpg.com.aux> wrote in message news:c72drs$hiu$1@digitaldaemon.com... > Hi, > > In another thread I mentioned that I would convert my game to D. Well all was good until step 3 of 45672345. > > I looked at Walter's empire windows code and noticed that he wrapped the globals in a struct - so I did too. > > (This is when I decided that I had an issue with 'with'). > > Now here's where my lack of D savvy will show. When I went to refer to the > struct in an other module I simply imported the module that the structure was declared in. It compiles but won't link. > > I get 'Error 42: Symbol Undefined _D4iced6globalS4iced7globals' in the importing obj module. I've tried every combination of export, extern I could think of; although I wouldn't have expected to need to. I also tried > declaring the variable public, still no luck. > > Any thoughts would be appreciated. > |
May 02, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Egan | Scott Egan wrote: > Hi, > > In another thread I mentioned that I would convert my game to D. Well all > was good until step 3 of 45672345. > > I looked at Walter's empire windows code and noticed that he wrapped the > globals in a struct - so I did too. > > (This is when I decided that I had an issue with 'with'). > > Now here's where my lack of D savvy will show. When I went to refer to the > struct in an other module I simply imported the module that the structure > was declared in. It compiles but won't link. > > I get 'Error 42: Symbol Undefined _D4iced6globalS4iced7globals' in the > importing obj module. I've tried every combination of export, extern I > could think of; although I wouldn't have expected to need to. I also tried > declaring the variable public, still no luck. > > Any thoughts would be appreciated. > > The structure definition and declaration are below. > > struct globals { > int Score; > bit Random; > HDC hDCVid, hDCScrn, hDCMem; > HINSTANCE Instant; > HWND hWndStat, hWndEdit, hWndIce; > char GameName[]; > int Lives, Screen, Stands, CountDown, Diamonds, TimeOut, Loaded, xScr, > yScr, yText, yChar, xChar, Width, Height; > byte SCRNX, SCRNY, retX, retY, GoodX, GoodY, HIT; > byte[64][64] Scrn; > }; > > globals global; If you have two files: main.d and imports.d, you probably need to put both of them in the compile line: dmd main.d imports.d I'm guessing this will solve your problem. Another way of solving this problem is to compile each separately: dmd imports.d -c dmd main.d imports.obj -- Justin http://jcc_7.tripod.com/d/ |
May 03, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | I'm using DIDE. It compiles fine, I just get a linker error. "J C Calvarese" <jcc7@cox.net> wrote in message news:c73aoq$1s63$1@digitaldaemon.com... > Scott Egan wrote: > > Hi, > > > > In another thread I mentioned that I would convert my game to D. Well all > > was good until step 3 of 45672345. > > > > I looked at Walter's empire windows code and noticed that he wrapped the globals in a struct - so I did too. > > > > (This is when I decided that I had an issue with 'with'). > > > > Now here's where my lack of D savvy will show. When I went to refer to the > > struct in an other module I simply imported the module that the structure > > was declared in. It compiles but won't link. > > > > I get 'Error 42: Symbol Undefined _D4iced6globalS4iced7globals' in the importing obj module. I've tried every combination of export, extern I could think of; although I wouldn't have expected to need to. I also tried > > declaring the variable public, still no luck. > > > > Any thoughts would be appreciated. > > > > The structure definition and declaration are below. > > > > struct globals { > > int Score; > > bit Random; > > HDC hDCVid, hDCScrn, hDCMem; > > HINSTANCE Instant; > > HWND hWndStat, hWndEdit, hWndIce; > > char GameName[]; > > int Lives, Screen, Stands, CountDown, Diamonds, TimeOut, Loaded, xScr, > > yScr, yText, yChar, xChar, Width, Height; > > byte SCRNX, SCRNY, retX, retY, GoodX, GoodY, HIT; > > byte[64][64] Scrn; > > }; > > > > globals global; > > > If you have two files: main.d and imports.d, you probably need to put both of them in the compile line: > > dmd main.d imports.d > > I'm guessing this will solve your problem. > > > Another way of solving this problem is to compile each separately: > > dmd imports.d -c > dmd main.d imports.obj > > -- > Justin > http://jcc_7.tripod.com/d/ |
May 03, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phill | Thanks Phill. I got yours working even after I moved the 'globals g' definition to the glbl.d file. The only diference I noted was that you used the module statement at the top of the glbl.d file. So I included it at the top of my file and the problem went away. Now....why?!!! The reat of my files are imported OK without module statements. I thought modulename = filename (less .d) if not specified. Any thoughts? "Phill" <phill@pacific.net.au> wrote in message news:c72hbg$mof$1@digitaldaemon.com... > I dont think its a problem with the linker, maybe you > have just overlooked something. > > Ive attached a simple example. > > Phill. > > > "Scott Egan" <scotte@tpg.com.aux> wrote in message news:c72drs$hiu$1@digitaldaemon.com... > > Hi, > > > > In another thread I mentioned that I would convert my game to D. Well all > > was good until step 3 of 45672345. > > > > I looked at Walter's empire windows code and noticed that he wrapped the globals in a struct - so I did too. > > > > (This is when I decided that I had an issue with 'with'). > > > > Now here's where my lack of D savvy will show. When I went to refer to > the > > struct in an other module I simply imported the module that the structure > > was declared in. It compiles but won't link. > > > > I get 'Error 42: Symbol Undefined _D4iced6globalS4iced7globals' in the importing obj module. I've tried every combination of export, extern I could think of; although I wouldn't have expected to need to. I also > tried > > declaring the variable public, still no luck. > > > > Any thoughts would be appreciated. > > > > > > |
May 03, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Egan | "Scott Egan" <scotte@tpg.com.aux> wrote in message news:c759sl$1onr$1@digitaldaemon.com... > I'm using DIDE. > > It compiles fine, I just get a linker error. > When you made the module with the struct in it, did you go: File-> New File Into Project or just File-> New ? Phill |
May 03, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Egan | "Scott Egan" <scotte@tpg.com.aux> wrote in message news:c75aun$1qhc$1@digitaldaemon.com... > Thanks Phill. > > I got yours working even after I moved the 'globals g' definition to the glbl.d file. > > The only diference I noted was that you used the module statement at the top > of the glbl.d file. > > So I included it at the top of my file and the problem went away. > > Now....why?!!! The reat of my files are imported OK without module statements. > > I thought modulename = filename (less .d) if not specified. Any thoughts? > I dont know, I only put that there to look fancy lol it works either way with mine. I am not familiar with the way that the 'module' thing works, or whether you have to compile it in a similar way to Java's packages. Im waiting for Mathew's book. :o)) Or a tutorial to be written. I also use DIDE. See my other post, maybe it can help. Phill. |
May 03, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phill | Don't worry it's in the project (file new into project) "Phill" <phill@pacific.net.au> wrote in message news:c75b29$1qlt$1@digitaldaemon.com... > > "Scott Egan" <scotte@tpg.com.aux> wrote in message news:c759sl$1onr$1@digitaldaemon.com... > > I'm using DIDE. > > > > It compiles fine, I just get a linker error. > > > > When you made the module with the struct in it, did > you go: > File-> New File Into Project > or just > File-> New > ? > > Phill > > > |
May 04, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Egan | Scott Egan wrote: > I'm using DIDE. Do you have a command line? Have you tried it? > > It compiles fine, I just get a linker error. Sorry I was unclear, but I'm talking about a linker error. If both files aren't compiled, I don't think it will link. Your problem might be elsewhere, but without entire files I can only guess what the problem is. If you haven't got it to work yet, you have some options: 1) Post the whole files of source code so that the rest of us aren't fumbling around in the dark. 2) Try compiling at the command line. Or by using a batch file. I have nothing against using DIDE; I use it all the time for editing files. But that doesn't prevent me from using the commmand line, batch files, or makefiles. I'm flexible. > "J C Calvarese" <jcc7@cox.net> wrote in message > news:c73aoq$1s63$1@digitaldaemon.com... > >>Scott Egan wrote: >> >>>Hi, >>> >>>In another thread I mentioned that I would convert my game to D. Well > > all > >>>was good until step 3 of 45672345. >>> >>>I looked at Walter's empire windows code and noticed that he wrapped the >>>globals in a struct - so I did too. >>> >>>(This is when I decided that I had an issue with 'with'). >>> >>>Now here's where my lack of D savvy will show. When I went to refer to > > the > >>>struct in an other module I simply imported the module that the > > structure > >>>was declared in. It compiles but won't link. >>> >>>I get 'Error 42: Symbol Undefined _D4iced6globalS4iced7globals' in the >>>importing obj module. I've tried every combination of export, extern I >>>could think of; although I wouldn't have expected to need to. I also > > tried > >>>declaring the variable public, still no luck. >>> >>>Any thoughts would be appreciated. >>> >>>The structure definition and declaration are below. >>> >>>struct globals { >>> int Score; >>> bit Random; >>> HDC hDCVid, hDCScrn, hDCMem; >>> HINSTANCE Instant; >>> HWND hWndStat, hWndEdit, hWndIce; >>> char GameName[]; >>> int Lives, Screen, Stands, CountDown, Diamonds, TimeOut, Loaded, xScr, >>>yScr, yText, yChar, xChar, Width, Height; >>> byte SCRNX, SCRNY, retX, retY, GoodX, GoodY, HIT; >>> byte[64][64] Scrn; >>>}; >>> >>>globals global; >> >> >>If you have two files: main.d and imports.d, you probably need to put >>both of them in the compile line: >> >>dmd main.d imports.d >> >>I'm guessing this will solve your problem. >> >> >>Another way of solving this problem is to compile each separately: >> >>dmd imports.d -c >>dmd main.d imports.obj >> >>-- >>Justin >>http://jcc_7.tripod.com/d/ > > > -- Justin http://jcc_7.tripod.com/d/ |
May 04, 2004 Re: Please Help! Linker problem (me!) | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | Thanks, after looking at Phills source, I noticed that the importeded module had a specific module statement, so I included on in mine. That fixed the problem. All files were compiling and the only thing I can thing of is that I named the file in uppercase. "J C Calvarese" <jcc7@cox.net> wrote in message news:c77ap6$1r4g$1@digitaldaemon.com... > Scott Egan wrote: > > I'm using DIDE. > > Do you have a command line? Have you tried it? > > > > > It compiles fine, I just get a linker error. > > Sorry I was unclear, but I'm talking about a linker error. If both files aren't compiled, I don't think it will link. Your problem might be elsewhere, but without entire files I can only guess what the problem is. > > > If you haven't got it to work yet, you have some options: > > 1) Post the whole files of source code so that the rest of us aren't fumbling around in the dark. > > 2) Try compiling at the command line. Or by using a batch file. I have nothing against using DIDE; I use it all the time for editing files. But that doesn't prevent me from using the commmand line, batch files, or makefiles. I'm flexible. > > > > "J C Calvarese" <jcc7@cox.net> wrote in message news:c73aoq$1s63$1@digitaldaemon.com... > > > >>Scott Egan wrote: > >> > >>>Hi, > >>> > >>>In another thread I mentioned that I would convert my game to D. Well > > > > all > > > >>>was good until step 3 of 45672345. > >>> > >>>I looked at Walter's empire windows code and noticed that he wrapped the > >>>globals in a struct - so I did too. > >>> > >>>(This is when I decided that I had an issue with 'with'). > >>> > >>>Now here's where my lack of D savvy will show. When I went to refer to > > > > the > > > >>>struct in an other module I simply imported the module that the > > > > structure > > > >>>was declared in. It compiles but won't link. > >>> > >>>I get 'Error 42: Symbol Undefined _D4iced6globalS4iced7globals' in the importing obj module. I've tried every combination of export, extern I could think of; although I wouldn't have expected to need to. I also > > > > tried > > > >>>declaring the variable public, still no luck. > >>> > >>>Any thoughts would be appreciated. > >>> > >>>The structure definition and declaration are below. > >>> > >>>struct globals { > >>> int Score; > >>> bit Random; > >>> HDC hDCVid, hDCScrn, hDCMem; > >>> HINSTANCE Instant; > >>> HWND hWndStat, hWndEdit, hWndIce; > >>> char GameName[]; > >>> int Lives, Screen, Stands, CountDown, Diamonds, TimeOut, Loaded, xScr, > >>>yScr, yText, yChar, xChar, Width, Height; > >>> byte SCRNX, SCRNY, retX, retY, GoodX, GoodY, HIT; byte[64][64] Scrn; > >>>}; > >>> > >>>globals global; > >> > >> > >>If you have two files: main.d and imports.d, you probably need to put both of them in the compile line: > >> > >>dmd main.d imports.d > >> > >>I'm guessing this will solve your problem. > >> > >> > >>Another way of solving this problem is to compile each separately: > >> > >>dmd imports.d -c > >>dmd main.d imports.obj > >> > >>-- > >>Justin > >>http://jcc_7.tripod.com/d/ > > > > > > > > > -- > Justin > http://jcc_7.tripod.com/d/ |
Copyright © 1999-2021 by the D Language Foundation