Visual Studio errors

edited April 2017 in Programming
I've been at this for days now - the BGI (Borland Graphics Interface) is crashing the linker in Visual Studio 2005.

I've written a moderately complex program (it's a game) which calls a function called showGraphic(int id) from the title screen to draw a picture on screen.

The plotting is done, the program works before hand, everything works...

Then I implemented the graphics, and now I get 5 linking errors LNK2019 - Unresolved External Symbols and a sixth error telling me about these 5 errors LNK1120.

Problem is, I don't know what's wrong with it, I've check syntax time and time again, checked StackOverflow, checked Visual C++ documentation, just about everything - I even injected the part of the program that draws the graphics into another program and it worked fine!

I've tried compiling, recompiling, building, and deleted the debug files to force recompilation, but nothing of the sort has worked. The computer has been restarted multiple times by now, and nothing seems to fix it.

Everything points to problems with objects in the program not sharing variables - but I'm doing most of the program procedurally, and this is an impossible conclusion.

All variables being passed into the function are static, as well as the variables being passed to the BGI.

Here's a list of the functions causing the linking errors, if applicable:
cleardevice();
initwindow(int width,int height,char title);
setbkcolor(int color);
setcolor(int color);
line(int x1,int y1,int x2,int y2);

If I comment the offending lines out, it works fine (even when playing the background music, which is done with an external program). If I so much as let one line in, it immediately throws the error back again. This happens both in showGrapic(); and in the title screen function title();.

Don't ask why we're using such an old system - it's because some developers of this game are still stuck on Windows 2000 with no reliable upgrade path. I'm not here to argue about the use of old software, please.

Ideas? Suggestions?

Comments

  • I apologize if this wouldn't be related or helpful but have you considered trying to do this while running visual studio under a different compatibility such as XP or even 98 via kernelex?
  • OK, your code is fine. Or probably fine, as long as the LNK1120 errors are the *only* errors that your code is producing.

    BGI is old. Very old, for DOS era coding and either A) your VS Linker is unable to locate your graphics.lib in a library path or B), the more likely option is that the .lib is too old for VS and VC++ to want to work with and link in.

    Try something like http://openbgi.sourceforge.net maybe?
Sign In or Register to comment.