![]() |
Register | Login | |||||
![]() |
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
![]()
| |
Acmlm's Board - I2 Archive - - Posts by beneficii |
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
User | Post | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(restricted)
beneficii |
![]() Lakitu Level: 36 Posts: 382/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
My username is simply the genitive form of the Latin noun beneficium (pronounced "beh neh fee kee oohm"), beneficii (pronounced "beh neh fee kee ee") (n) which means "good deed" or "kindness." My name is not in any way, shape, fashion, or form Ben and I resent people who call me Ben because it's just not me. |
I've had beneficii for at about 3-4 years and was originally an RA2 Westwood Online account because I was trying to think of a new one to replace my old one that I got tired of. (edited by beneficii on 08-05-05 01:35 AM) (edited by beneficii on 08-05-05 01:37 AM) (edited by beneficii on 08-05-05 01:37 AM) (edited by beneficii on 08-05-05 01:39 AM) (restricted) |
beneficii |
![]() Lakitu Level: 36 Posts: 384/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Alright, I'm working on a project in C++ that has multiple source files with the same header file between them. Any variable I declare specific to a source file I declare as static (i.e. that is only for that source file) and any variable that is shared between source files is declared in the header file (not as static) I would think that most here would agree that this is standard practice in really big projects. |
Now, I've tried compiling my project, I've gone through and corrected all syntax editors and it looks like I'm finally going to get it to compile when BAM! a very looooong list of linker errors shows up. They all said: multiple definition of 'variable' first defined here (I'm using Bloodshed Dev C++ v. 4.9.9.2 btw and its default compiler GNU C++ Compiler.) After that, I look at those variables and I see that they are all declared in the header file! I go to the compile log and see basically this: sourcefileB.cpp: multiple definition of 'variableJ' // again variableJ is declared only in the header file sourcefileA.cpp: first defined here sourcefileC.cpp: multiple definition of 'variableJ' sourcefileA.cpp: first defined here sourcefileD.cpp: multiple definition of 'variableJ' sourcefileA.cpp: first defined here I'm thinking, okay, why is there a conflict here? Doesn't the linker know that these variables were all declared in a header file that was simply used by all the source files? I wrote a much smaller program afterward with two source files and a header file, which was included in both source files. I declared some variables in the header file. When it compiled, there was no conflict and the program ran normally. I'm wondering, What makes my program so different? Is it a problem with the compiler, or is there perhaps a common trap that I'm falling for? Can any of you perhaps help me? Thanks. ![]()
beneficii |
![]() Lakitu Level: 36 Posts: 385/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
I won. Basically, you want it to be your opponent's turn when there are 5 gemstones left. If it's his turn, then there is no way he can win if you're playing your best. Now about getting down to that.... |
Edit: If it's your turn and you have 9 left, you also lose. Edit 2: Ah, I figured it out now. It's actually quite simple, you want to avoid having it be a "losing" number when it's your turn. The losing numbers start at 5 and increment by 4 each time. That is why you want to go first, because you want to get your opponent with the losing numbers from the start otherwise you can't get out of him doing that to you. (edited by beneficii on 08-06-05 01:52 AM) (edited by beneficii on 08-06-05 01:54 AM) (edited by beneficii on 08-06-05 01:58 AM) (edited by beneficii on 08-06-05 01:59 AM) (edited by beneficii on 08-06-05 02:02 AM)
beneficii |
![]() Lakitu Level: 36 Posts: 386/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by neotransotaku Hold on. Nope, if I do it #ifdef __headerfile, then __headerfile will never get defined. I tested it out anyway, and when I compiled the program it said that none of the variables defined in the header file were defined. I next tried #ifndef __headerfile, which seemed more logical, but still had the problem of multiple declarations. I counted the same number of underscores and everything. I wonder what's wrong. (edited by beneficii on 08-06-05 02:37 AM) (edited by beneficii on 08-06-05 02:43 AM)
beneficii |
![]() Lakitu Level: 36 Posts: 387/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by Disch That'll make it easier to manage a large file full of global vars. The #define _EXTERN saves you from having to make (and maintain) two sets (bodied and body-less) since it keeps both in the same file. Okay, so I would have to add _EXTERN in front of every variable in the header file? Also, put in DO_NOT_MAKE_EXTERN and DO_NOT_MAKE_EXTERNS or was that a typo? Thanks.
beneficii |
![]() Lakitu Level: 36 Posts: 388/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by DischOriginally posted by beneficii I think I understand what this does. If DO_NOT_MAKE_EXTERN is defined, then it defines __EXTERN as nothing, which makes the variable normal. If it's not defined, then it defines __EXTERN as extern, which makes the variable extern. You only want it one source without the extern, while everyone else should have it, so you define DO_NOT_MAKE_EXTERN for it. Thanks. ![]() EDIT: Ugh this is so frustrating! I did as you said, and it did something new. First, it said: [Warning] 'vars' initialized and declared 'extern' // for each variable in the header file then it went right back to complaining about multiple declarations as it did before. I declared DO_NOT_MAKE_EXTERN in one file (and it was for that file ("in file included from file") I didn't get the warnings). Do you have any recommendations? (edited by beneficii on 08-06-05 12:18 PM)
beneficii |
![]() Lakitu Level: 36 Posts: 389/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by Disch Uh, well, that's going to take some time to correct, because those vars are meant to be constant arrays, but I'll see what I can do.
beneficii |
![]() Lakitu Level: 36 Posts: 390/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by Disch Okay, thank you! I should have seen that! If a variable is initialized in the declaraqtion it won't let it be extern. Thank you! ![]() Onto the next stage of my program and arguably the most challenging: the logic tests! ![]()
beneficii |
![]() Lakitu Level: 36 Posts: 391/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
It'd be a useless mathematical system and we'd all be dummies for implementing it, so yeah the caves live in we would. |
beneficii |
![]() Lakitu Level: 36 Posts: 392/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by Kefka You can't win when you pick the second turn: not if your opponent is playing his best. I think that the computer you go against does play its best.
beneficii |
![]() Lakitu Level: 36 Posts: 393/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
When do static variables (declared in a particular source file) go out of scope? It seems like when a DlgProc is called in a source file the static variables in that source file go out of scope because all of a sudden they get weird random values (making me think that they are as though they haven't been initialized). So what's causing it? |
beneficii |
![]() Lakitu Level: 36 Posts: 394/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by Disch What's been happening is this: #include "myfavoriteheaderfile.h" static int var1; //outside of function int getbox(HWND owner) { var1 = 5; return DialogBox((HINSTANCE) GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_MOTHERDUDDER), owner, MyFavProc); } BOOL CALLBACK MyFavProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_INITDIALOG:{ char tempchr[10]; itoa(var1, tempchr, 10); MessageBox(hwnd, tempchr, "Titlebar", MB_OK); /* In the body of the MessageBox, it will show some weird ass value--every value I've seen is always "80808080" */ /* etc etc rest of program */ Do you seem my point, Disch? It's like var1 went out of scope, because it gave the value of 80808080. What do you recommend for that? (edited by beneficii on 08-06-05 07:24 PM)
beneficii |
![]() Lakitu Level: 36 Posts: 395/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by Disch That was just a sample. I thought you would have noticed that wasn't my real program. Anyway, I had the WndProc call a function and it didn't return 80808080 anymore, because like totally that is messed up. Still, somtimes when I call it function from the Proc it'll still give me 80808080. And I get all sorts of unpredictable effects from that.
beneficii |
![]() Lakitu Level: 36 Posts: 396/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
This just spooks me out: |
http://sun-herald.com/Newsheadline.cfm?headline=6413&banner=1 There was a huge convoy of sea creatures heading south near Englewood Beach in Flordia and freaky they weren't attacking each other or anything. Something seems so foreboding about all this....
beneficii |
![]() Lakitu Level: 36 Posts: 397/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
In greatest probability, red tide (overgrowth of algae causing depletion of oxygen in the water) was the cause of this, forcing the animals to move to another location or die. If so, then this is probably one of the severist cases of red tide on record. |
beneficii |
![]() Lakitu Level: 36 Posts: 398/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Rebel! Freedom! Liberty! To arms! To arms! |
beneficii |
![]() Lakitu Level: 36 Posts: 399/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours
|
Originally posted by Kasumi-Astra I'm glad they managed to get home okay. (restricted) | |
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
Acmlm's Board - I2 Archive - - Posts by beneficii |