|
-
Jan 4th, 2003, 08:30 PM
#1
Thread Starter
Frenzied Member
Strange linker errors....
hi...
I have been working on a game for some time, but suddenly it wont compile(I have compiled it before) and I get the following errors:
Deleting intermediate files and output files for project 'CrazyBalls 2 - Win32 Debug'.
--------------------Configuration: CrazyBalls 2 - Win32 Debug--------------------
Compiling...
main.cpp
f:\game programming projects\crazyballs 2\main.cpp(45) : warning C4005: 'SCREEN_BPP' : macro redefinition
f:\game programming projects\crazyballs 2\gpdumb1.h(12) : see previous definition of 'SCREEN_BPP'
f:\game programming projects\crazyballs 2\main.cpp(137) : warning C4101: 'ps' : unreferenced local variable
f:\game programming projects\crazyballs 2\main.cpp(136) : warning C4101: 'hdc' : unreferenced local variable
f:\game programming projects\crazyballs 2\main.cpp(523) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\main.cpp(526) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
GPDUMB1.CPP
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1229) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1234) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1240) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1246) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1254) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1261) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1270) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1277) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1286) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1292) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1301) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1307) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1350) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1357) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1366) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1373) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1382) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1388) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1397) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
f:\game programming projects\crazyballs 2\gpdumb1.cpp(1403) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
GPDUMB2.CPP
f:\game programming projects\crazyballs 2\gpdumb2.cpp(783) : warning C4101: 'work_color' : unreferenced local variable
f:\game programming projects\crazyballs 2\gpdumb2.cpp(1462) : warning C4553: '==' : operator has no effect; did you intend '='?
gpdumb3.CPP
Linking...
GPDUMB2.OBJ : error LNK2001: unresolved external symbol __imp__mmioAscend@12
GPDUMB2.OBJ : error LNK2001: unresolved external symbol __imp__mmioRead@12
GPDUMB2.OBJ : error LNK2001: unresolved external symbol __imp__mmioClose@8
GPDUMB2.OBJ : error LNK2001: unresolved external symbol __imp__mmioDescend@16
GPDUMB2.OBJ : error LNK2001: unresolved external symbol __imp__mmioOpenA@12
CrazyBalls_2___Win32_Debug0/CrazyBalls 2.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.
CrazyBalls 2.exe - 6 error(s), 27 warning(s)
hope you can help me out here...
PS: i have included all the libs and .h's
-
Jan 5th, 2003, 03:59 AM
#2
Fanatic Member
I have no solution, but can only tell that I had the same problem with the libjpeg OS library. I had totally no idea what went wrong. It seemed that the linker could find the function names with an underscore prefixed, but then I got some other problems.
I hope you'll find the solution to your problem; it might be the solution for mine as well
-
Jan 5th, 2003, 08:15 AM
#3
You need to add the multimedia import library to your project. (winmm.lib)
This should take care of the errors.
The warnings are to be heeded too.
f:\game programming projects\crazyballs 2\main.cpp(45) : warning C4005: 'SCREEN_BPP' : macro redefinition
This means you already have defined this macro somewhere. You should avoid that. Give it a different name.
And since this is C++ it would be better to use a const global variable.
f:\game programming projects\crazyballs 2\main.cpp(137) : warning C4101: 'ps' : unreferenced local variable
f:\game programming projects\crazyballs 2\main.cpp(136) : warning C4101: 'hdc' : unreferenced local variable
I guess these come from the WndProc. How do you handle WM_PAINT?
If you simply do
ValidateRect(hwnd, NULL);
then remove the declarations of those two variables.
f:\game programming projects\crazyballs 2\gpdumb2.cpp(783) : warning C4101: 'work_color' : unreferenced local variable
Same here. work_color was declared but not used.
f:\game programming projects\crazyballs 2\gpdumb2.cpp(1462) : warning C4553: '==' : operator has no effect; did you intend '='?
Did you?
f:\game programming projects\crazyballs 2\main.cpp(526) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
Although usually intended and not tragic, you shouldn't disable this warning, but at the same time the numerous warnings are confusing and might occlude real errors.
The solution is to explicitly cast. Instead of
Code:
double d = 3.0;
int i = d; // C4244
write
Code:
double d = 3.0;
int i = static_cast<int>(d);
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 5th, 2003, 08:41 AM
#4
Guru
To include winmm.lib, you can either add it to the project (same way you add a .cpp file), or add it to the Project Settings, or write
Code:
#pragma comment(lib, "winmm.lib")
in one of the .cpp files.
-
Jan 5th, 2003, 10:33 AM
#5
Thread Starter
Frenzied Member
thanks guys! the winmm did the thing!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|