need help from any programmers in C.. - Ford Forums - Mustang Forum, Ford Trucks, Ford Focus and Ford Cars
Ford Forum Ford Forum

» Auto Insurance
» Featured Product
Ā» Wheel & Tire Center

Go Back   Ford Forums - Mustang Forum, Ford Trucks, Ford Focus and Ford Cars > Fordforums Community > The Pub
Register Home Forum Active Topics Photo Gallery Auto Loans Garage Mark Forums Read Auto Escrow

The Pub For General Discussion

FordForums.com is the premier Ford Forum on the internet. Registered Users do not see the above ads.
Reply
 
LinkBack Thread Tools Display Modes
Old 09-12-2002, 21:03   #1 (permalink)
Registered User
 
Join Date: Sep 2001
Location: Perth
Posts: 1,386
need help from any programmers in C..

I'm just new to C and im having an error pop up and waas wondering if you guys could help.

This is the program I have


Quote:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* return with error code */
}
line(0, 0, getmaxx(), getmaxy());
getch();
closegraph();
return 0;
}
And these are the Error messages...

Quote:
Linking ..\OUTPUT\NONAME00.EXE:
Linker Error: Undefined symbol _closegraph in module NONAME00.CPP
Linker Error: Undefined symbol _line in module NONAME00.CPP
Linker Error: Undefined symbol _getmaxx in module NONAME00.CPP
Linker Error: Undefined symbol _getmaxy in module NONAME00.CPP
Linker Error: Undefined symbol _grapherrormsg in module NONAME00.CPP
Linker Error: Undefined symbol _graphresult in module NONAME00.CPP
•Linker Error: Undefined symbol _initgraph in module NONAME00.CPP
The program is copied exactly out of the help file in C... its the initgraph function that i got it from.

I'm using turbo c++

Cheers
__________________
EL driver...
Futura97 is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 09-12-2002, 23:16   #2 (permalink)
Mmm, high pressure wash.
 
3Toed's Avatar
 
Join Date: Nov 2001
Location: Sydney, Australia
Age: 40
Posts: 3,086
Firstly, you're missing some filenames after the #include statements. But I'm guessing they removed from the post because they were enclosed in greater than and less than characters.

Since it's a linker error, you need to link the compiled C code with the appropriate link library. Look through the doco that came with that example and see what linker libraries it needs. It'll be some kind of math and/or graphing library. I've never used Turbo C so I don't know that the library names are or what the options are.

EDIT: Another thing I thought of is that examples sometimes are not newbie-friendly. It could be that the functions called by your program (that failed the linker) are supposed to be defined by you in one of the include files or in the main program file itself.
__________________
Slothmobileā„¢ n. (slŨthmŨbÄ“l)
Off-white EL Series II Falcon GLi Sapphire (4.0L Slothmaticā„¢) with K&N Filtercharger, Tickford Sports Suspension, DBA Longlife Gold (front), DBA Longlife Slotted (rear) and Bendix Ultimates all round. Driven by The Slothmanā„¢.

Co-Founding Member of 3FB Inc, or the Ford Forums Food Bandits, where cruising, eating and talking shite is what it's all about. Click here to visit the official (albeit slightly outdated) website!


Quote:
Originally Posted by Team GT Media
We love having 3FB Inc guys around!
3Toed is offline   Reply With Quote
Old 09-13-2002, 03:20   #3 (permalink)
au2 forte
 
Join Date: Jul 2001
Location: melb
Posts: 139
I just had a quick look at that example. There's a couple of things you'll probably have to do:

1) One of the include statements refers to "graphics.h", which has an associated graphics library (as 3Toed was saying). So when you compile you need to link it to that library. To do that (assuming you're using the gui not the command line): From the menu click -> [Options] -> [Linker] -> [Libraries] -> and tick the "Graphics Library" box. (make sure the "standard runtime library" is ticked as well (but it usually is)).

2)Try and compile / run the program now. It should at least compile / link and generate a ".exe" file. When you run it, you'll probably get an error, that "egavga.bgi couldn't be found". So to fix that, there's a directory called "bgi" under the directory where your turbo c++ is installed. Copy the egavga.bgi file to the directory which has the executable file you have created. Now hopefully it should work.

Well that's all I did and it worked for me. Good luck :)
au2_xpack is offline   Reply With Quote
Old 09-13-2002, 06:09   #4 (permalink)
gone
 
laminge's Avatar
 
Join Date: Feb 2001
Posts: 10,402
Too many putah hippies for my liking!
laminge is offline   Reply With Quote
Old 09-13-2002, 07:34   #5 (permalink)
Registered User
 
Join Date: Sep 2001
Location: Perth
Posts: 1,386
cool... thanks au2_xpack. That got it working.

But i got the missing bgi error you predicted. I tried adding the directory that it resides in(c:\tc\bgi) in the include directories, but it still didn't work.

So i just copied the bgi files into the c:\tc\bin directory and presto!!

Thanks man...
__________________
EL driver...
Futura97 is offline   Reply With Quote
Old 09-14-2002, 17:29   #6 (permalink)
EA S pack
 
Join Date: Jul 2002
Location: sydney (west)
Posts: 25
sorry guys but what does the program do??

just curious...
diesel1336 is offline   Reply With Quote
Old 09-15-2002, 01:23   #7 (permalink)
Registered User
 
Join Date: Sep 2001
Location: Perth
Posts: 1,386
draws a diagonal line from top left to bottom right. Just a simple program so I can start to get the hang of using basic graphics in C
__________________
EL driver...
Futura97 is offline   Reply With Quote
Sponsored Links
Advertisement
 
Reply

  Ford Forums - Mustang Forum, Ford Trucks, Ford Focus and Ford Cars > Fordforums Community > The Pub



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dont mess with Skippy! bafel The Pub 1 02-03-2003 03:13
Web Page/ Graphic Designing big_pete The Pub 4 07-04-2002 07:12

Powered by vBadvanced CMPS v3.2.2

All times are GMT -7. The time now is 15:23.



Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0
Garage Plus vBulletin Plugins by Drive Thru Online, Inc.