Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Win98 Mouse issues

This thread is locked; no one can reply to it. rss feed Print
Win98 Mouse issues
Jim_KEwl
Member #1,583
October 2001

I'm having some trouble using the mouse in my allegro programs.
I'm not sure if it's setup related but this seemed like a good place to post it.
When I compile any program that uses
extern volatile int mouse_x; or any of the volitile mouse variables I get a messed up linker message.
Note no problems up untill linking.
Does anyone else have this problem or do you think I installed it improperly.
I followed Bob's Dev-C++ \ Allegro instructions to a tee.

DanielH
Member #934
January 2001
avatar

Considering that nearly every program on the allegro depot uses the mouse, I don't think its an allegro problem.

How are you linking allegro to your program?

Could you post some snippet of the code that access mouse_x, mouse_y, etc.

Jim_KEwl
Member #1,583
October 2001

Come to think of it.. in the example directory all the examples work. So it may be a problem I'm having with Dev-C++
well here are my linker messages:
code:Warning: resolving _mouse_y by linking to __imp__mouse_y (auto-import)
Warning: resolving _mouse_x by linking to __imp__mouse_x (auto-import)
fu000001.o(.idata$3+0xc): undefined reference to `lib_mingw32_liballeg_a_iname'
fu000003.o(.idata$3+0xc): undefined reference to `lib_mingw32_liballeg_a_iname'
nmth000000.o(.idata$4+0x0): undefined reference to `_nm__mouse_y'
nmth000002.o(.idata$4+0x0): undefined reference to `_nm__mouse_x'
I get these any time I try to the extern mouse variables heres some sample code that generated those errors
code:#include <allegro.h>
extern volatile int mouse_x;
extern volatile int mouse_y;
extern volatile int mouse_b;
int main() {
allegro_init();
install_mouse();
install_keyboard();
set_gfx_mode(GFX_AUTODETECT, 320,200,0,0);
while (key[KEY_ESC]) {
textprintf(screen, font, 1,1,10,"Mouse: %d,%d",mouse_x,mouse_y);
};
return 0;
}
END_OF_MAIN();
And here's what the Dev-C++ compile log looks like:
code:Linking files :
C:\DEVCPP\BIN\g++ "c:\mywork\mouse\main.o" -o c:\mywork\mouse\Mouse.exe C:\DevCpp\Lib\liballeg.a -s -IC:\DEVCPP\INCLUDE\ -IC:\DEVCPP\INCLUDE\G__~1 -IC:\DEVCPP\INCLUDE\ -LC:\DEVCPP\LIB\ -BC:\DEVCPP\BIN\

My Dev-C++/MinGW32/Allegro installation is per Bob's specifications

Bob
Free Market Evangelist
September 2000
avatar

code:
extern volatile int mouse_x;
extern volatile int mouse_y;
extern volatile int mouse_b;

Uhm, what are those doing here? You don't need them since they're already in Allegro. Just delete those lines and recompile.

--
- Bob
[ -- All my signature links are 404 -- ]

DanielH
Member #934
January 2001
avatar

I had this funny feeling that is what he was doing. That's why I wanted to look at his code.

Jim_KEwl
Member #1,583
October 2001

Hehe don't I feel stupic :-[

I used to do it that way with djgpp and it worked, now I'm on mingw32 and it slaps my wrist for that sort of behavior.

23yrold3yrold
Member #1,134
March 2001
avatar

Stupic, eh? ;)

Quote:

I used to do it that way with djgpp and it worked, now I'm on mingw32 and it slaps my wrist for that sort of behavior.

WHy would you do it in the first place? Is it really necessary?

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Jim_KEwl
Member #1,583
October 2001

Yes stupic
stupid, drunk and hiccuping would be the only excuse for half the code I write (the other half is pure genius but, I have trouble telling the two apart)
Well I started out with allegro and djgpp not knowing what I was doing (not saying I've improved much) and pure stupidity evolved into a bad habit.
I'm having a problem breaking it too.
I like seeing my externs at the top of my cpp file as a reminder that the variable isn't local. Suppose comments would work too
C++ is too picky, maybe I should go back to assembler where it takes any crap you throw at it... then your computer blows up when you run the program.

Go to: