digitalmars.D - Please Help! Linker problem (me!)
- "Scott Egan" <scotte tpg.com.aux> May 02 2004
- "Phill" <phill pacific.net.au> May 02 2004
- "Scott Egan" <scotte tpg.com.aux> May 03 2004
- "Phill" <phill pacific.net.au> May 03 2004
- "Matthew" <matthew.hat stlsoft.dot.org> May 07 2004
- "Phill" <phill pacific.net.au> May 07 2004
- "Matthew" <matthew.hat stlsoft.dot.org> May 07 2004
- "Phill" <phill pacific.net.au> May 08 2004
- J C Calvarese <jcc7 cox.net> May 02 2004
- "Scott Egan" <scotte tpg.com.aux> May 03 2004
- "Phill" <phill pacific.net.au> May 03 2004
- "Scott Egan" <scotte tpg.com.aux> May 03 2004
- J C Calvarese <jcc7 cox.net> May 03 2004
- "Scott Egan" <scotte tpg.com.aux> May 04 2004
- J C Calvarese <jcc7 cox.net> May 04 2004
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
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
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
declaring the variable public, still no luck. Any thoughts would be appreciated.
May 02 2004
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
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
struct in an other module I simply imported the module that the
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
declaring the variable public, still no luck. Any thoughts would be appreciated.
May 03 2004
"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
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?
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
"Phill" <phill pacific.net.au> wrote in message news:c75bcl$1r05$1 digitaldaemon.com..."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
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?
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))
What book? What're you talking about. ;) (As soon as I can get DTL done and out of the way, then maybe I can pay attention to some other, more potentially lucrative matters ... <G>)Or a tutorial to be written. I also use DIDE. See my other post, maybe it can help.
May 07 2004
"Matthew" <matthew.hat stlsoft.dot.org> wrote in message news:c7hdi7$29ok$1 digitaldaemon.com..."Phill" <phill pacific.net.au> wrote in message news:c75bcl$1r05$1 digitaldaemon.com..."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
glbl.d file. The only diference I noted was that you used the module statement at
topof 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
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))
What book? What're you talking about. ;) (As soon as I can get DTL done and out of the way, then maybe I can pay
to some other, more potentially lucrative matters ... <G>)
Cant wait! Ofcourse you would include a chapter(at least) on the DTL? I have another OT question for you. I have read articles by you a Walter in Dr Dobbs. If one was to subscribe to a journal, which would you say would more likely have the odd D article in it? (Not including the D journal, because who knows when that will surface.) Thanks! Phill.
May 07 2004
"Phill" <phill pacific.net.au> wrote in message news:c7htjo$3057$1 digitaldaemon.com..."Matthew" <matthew.hat stlsoft.dot.org> wrote in message news:c7hdi7$29ok$1 digitaldaemon.com..."Phill" <phill pacific.net.au> wrote in message news:c75bcl$1r05$1 digitaldaemon.com..."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
glbl.d file. The only diference I noted was that you used the module statement at
topof 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
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))
What book? What're you talking about. ;) (As soon as I can get DTL done and out of the way, then maybe I can pay
to some other, more potentially lucrative matters ... <G>)
Cant wait! Ofcourse you would include a chapter(at least) on the DTL?
That's for sure. (Of course, nothing's sorted on the D book yet.) FYI, I'm actually thinking that of discussing other STL incarnations in other languages in my next book - "Extended STL". This'll fall naturally out of the Ranges concept work, since it spans both C++ and D, and I've also been chatting to some people about STL-like things in some other languages, but that's very early stuff.I have another OT question for you. I have read articles by you a Walter in Dr Dobbs.
To the best of my knowledge, so far we've had the following so far: WB: "The D Programming Language", DDJ, Feb 2002 MW: "C# Performance: Comparison with C, C++, D and Java, Parts 1 & 2", WDN, Special Online Supplement, Fall 2003 MW: "Identity and Equality: Syntax and Semantics", CUJ, October 2003 MW: "Positive Integration #3: Mapping recls to D and Java", CUJ, January 2004 WB + MW: "Collection Enumeration: Loops, Iterators and Nested Functions", DDJ, March 2004 WB: "Nested Functions", CUJ, May 2004 (I've also got a couple of Tech Tips in with DDJ that pertain to D which may see the light of day sometime over the next 6-12 months.)If one was to subscribe to a journal, which would you say would more likely have the odd D article in it?
Despite the distribution shown above, it's far more likely that we'll be doing more for Dr Dobb's than CUJ. In fact, we're planning to make a few proposals very soon, so I would hope you'd get some D-value out of a year's subscription to DDJ if you made it now. ;) But they're both great mags, so it depends on how much C++ vs everything-else you need.(Not including the D journal, because who knows when that will surface.)
Yeah, there are only so many hours in the day. Plus, for me, I've been living on thin air and shoe leather for the last 18 months - that's the romantic life of the penurious author <g> - so I favour submissions to paying journals when I can. Once I'm back in real work, I may well feel more than generously inclined towards TDJ, and aim my D submissions there.
May 07 2004
"Matthew" <matthew.hat stlsoft.dot.org> wrote in message news:c7humu$31jj$1 digitaldaemon.com..."Phill" <phill pacific.net.au> wrote in message news:c7htjo$3057$1 digitaldaemon.com..."Matthew" <matthew.hat stlsoft.dot.org> wrote in message news:c7hdi7$29ok$1 digitaldaemon.com..."Phill" <phill pacific.net.au> wrote in message news:c75bcl$1r05$1 digitaldaemon.com..."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
theglbl.d file. The only diference I noted was that you used the module statement
thetopof 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
statements. I thought modulename = filename (less .d) if not specified. Any
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))
What book? What're you talking about. ;) (As soon as I can get DTL done and out of the way, then maybe I can
attentionto some other, more potentially lucrative matters ... <G>)
Cant wait! Ofcourse you would include a chapter(at least) on the DTL?
That's for sure. (Of course, nothing's sorted on the D book yet.) FYI, I'm actually thinking that of discussing other STL incarnations in
languages in my next book - "Extended STL". This'll fall naturally out of
Ranges concept work, since it spans both C++ and D, and I've also been
to some people about STL-like things in some other languages, but that's
early stuff.I have another OT question for you. I have read articles by you a Walter in Dr Dobbs.
To the best of my knowledge, so far we've had the following so far: WB: "The D Programming Language", DDJ, Feb 2002 MW: "C# Performance: Comparison with C, C++, D and Java, Parts 1 & 2",
Special Online Supplement, Fall 2003 MW: "Identity and Equality: Syntax and Semantics", CUJ, October 2003 MW: "Positive Integration #3: Mapping recls to D and Java", CUJ, January
WB + MW: "Collection Enumeration: Loops, Iterators and Nested Functions",
March 2004 WB: "Nested Functions", CUJ, May 2004 (I've also got a couple of Tech Tips in with DDJ that pertain to D which
the light of day sometime over the next 6-12 months.)If one was to subscribe to a journal, which would you say would more
have the odd D article in it?
Despite the distribution shown above, it's far more likely that we'll be
more for Dr Dobb's than CUJ. In fact, we're planning to make a few
soon, so I would hope you'd get some D-value out of a year's subscription
if you made it now. ;) But they're both great mags, so it depends on how much C++ vs
need.(Not including the D journal, because who knows when that will surface.)
Yeah, there are only so many hours in the day. Plus, for me, I've been
thin air and shoe leather for the last 18 months - that's the romantic
the penurious author <g> - so I favour submissions to paying journals when
Once I'm back in real work, I may well feel more than generously inclined
TDJ, and aim my D submissions there.
Thanks Mathew! DDJ it shall be then. Phill.
May 08 2004
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 02 2004
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
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
struct in an other module I simply imported the module that the
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
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
"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
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 03 2004
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
allwas 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
thestruct in an other module I simply imported the module that the
structurewas 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
trieddeclaring 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 03 2004
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
allwas good until step 3 of 45672345. I looked at Walter's empire windows code and noticed that he wrapped
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
thestruct in an other module I simply imported the module that the
structurewas 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
trieddeclaring 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
Scott Egan wrote: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.
I'm glad to hear that. -- Justin http://jcc_7.tripod.com/d/
May 04 2004









"Phill" <phill pacific.net.au> 