![]() |
|
#1
|
|||
|
|||
Linked Lists advice requestHullo,
(I thought I'd start a new thread, so as to be tidier, and not appear to be begging.) This is a programme for drawing shapes and rotating them, moving them about, changing their size with cursor keys; I need to use linked lists to store the data for the shapes. I've only got 1 error in my code when I compile it: summat like this: Quote:
I've got "graphics_lib.h" in the following files: "C:\Documents and Settings\...\shapeshifter\shapeshifter\graphics_li b\HERE" "C:\Documents and Settings\...\shapeshifter\shapeshifter\HERE" "C:\Documents and Settings\...\shapeshifter\graphics_lib\& HERE" I've added it to the project and stuck it into the header file on the folder tree in the top left o' screen (I'm using MS Visual C++ 6 btw) and I get the same error message. Please could somebody help? Tidier (but still far from fixed) Code: CPP / C++ / C Code:
I've "//"-ed out a lot of the line stuff so I can focus on the triangle (esp the rotation)... where to shove this poxy graphics_lib.h file to get it compiling?! Please could someone help?! Last edited by LuciWiz : 15-May-2007 at 06:04.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Linked Lists advice requestQuote:
Try the following: Put graphics_lib.h in the same directory as the .c or .cpp file that includes it, then change the above line to CPP / C++ / C Code:
Dave |
|
#3
|
|||
|
|||
Re: Linked Lists advice requestHi Dave,
Thanks for your help, it's much appreciated! Did as you said (I think!) This is what I got: Quote:
A friend of mine offered these thoughts... what do you think? Quote:
|
|
#4
|
|||
|
|||
Re: Linked Lists advice requestQuote:
I think you should check the header file. (Since you are getting different errors, I am assuming that it is now finding the header that it couldn't see before. That's where the problem lies, I'm thinking.) When you include a file, and you have errors immediately after the #include statement, then look at what you included. Can you post it (the .h file)? Show the part of the file that includes it (mark for us whatever line that is flagged by the error message) and show us the .h file. Regards, Dave |
|
#5
|
|||
|
|||
Re: Linked Lists advice requestThe Graphics_lib.h is
Code:
the bit of code flagged is: Code:
it doesn't like this one... 4 of the 5 errors are on it... the other is just the "}" right at the very end of the prog. I'm pretty sure it's my crappy code that's to blame... I'll bet I've just not finished some part of it... as I say I'm too tired to play with it now, but I'll be spending most of tomorrow morning (GMT) on it. (beddie byes for me i think: i'm knackered!) |
|
#6
|
|||
|
|||
Re: Linked Lists advice requestIf you're still trying the code you have above I bet you're having problems. A nap sounds like a good idea! I saw potential nested comments, and a second main() for starters! Even after some cleanup and commenting out of more sections than you already had I still get a screen full of errors. Most about variables being out of scope and such. Nothing about graphics.h.
I thought you were getting good compiles with the graphics_lib.h you have. I am using the cs1300 ming32 stuff I got from here: 'http://www.cs.colorado.edu/~main/cs1300/doc/bgi/bgi.html' (gcc in windows... dude!) They call their winbgim library 'graphics.h' and it's updated a/o 2004. It is in the 'includes' directory and I use '#includes <graphics.h>' . There is also the 'libbgi.a' which is put in the 'lib' directory. It is linked as I compile somehow, I don't see it in graphics.h... Both files are available seperately. They also come with the full 30mb install. Try a smaller program, get a good compile, and THEN move on. Howard; |
|
#7
|
|||
|
|||
Re: Linked Lists advice requestQuote:
Quote:
Quote:
I note that you have included two non-standard headers here. <windows.h> from Microsoft has been copied (presumably licensed) by numerous other compiler vendors, but may not be exactly the same. I doubt that this is the problem. For <conio.h>, the functions prototyped there (and the corresponding library functions provided by the vendor) may be completely different from a <conio.h> from another vendor. Compilers from Borland have almost completely different functions prototyped in <conio.h> than from those Microsoft. Even different versions of Borland compilers have different functions thatn other versions of Borland compilers (!) If you can't get past line 31/32, then maybe you are missing something from one of the other headers. Note that simply copying a header file (or some function prototype) from some other distribution will not work, since it requires the actual function to be in your project somewhere (either in a library file or in some source code file. That's the problem with programs using other people's code with non-standard implementation-dependent headers and library functions. Even if they try to use conditional compilation flags (all of those confusing [klbd]#If defined[/kbd] thingies), it may work for some compilers and not for others. So: The first thing is to work on the first error. What is "line_type" and where is it defined. Then go from there. Regards, Dave |
|
#8
|
|||
|
|||
Re: Linked Lists advice requestHi Dave,
Cheers for that ...after removing the second "main()" I recompiled and got similar errors: The context of the error you asked about is Code:
NB: I have changed the graphics_lib.h to sit betwixt " " rather than < > as you said. ...aah see, from checking my old code I copied this from, I've changed "line_type" to "shape" but only on the typedef... time for some whittling... |
|
#9
|
|||
|
|||
Re: Linked Lists advice requestQuote:
Quote:
|
|
#10
|
|||
|
|||
Re: Linked Lists advice requestEver follow a thread only to find it was 3 BIG pages of stuff that could have been on one page?
Some of us are still on dialup! Again, reduce your program till you get no errors. Even if it's all the way back to printf("Hello World"); Then start adding your stuff back in until you do get errors. When you get one you don't understand: - post the error - post the section of code pertinent to the error It would save a lot of time and space. Thanks, Howard; PS: I don't see anything above about graphics_lib.h not being found, looks like syntax, context and data type mostly. There are certain rules in C Last edited by Howard_L : 15-May-2007 at 08:29.
Reason: added additional info kinda
|
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| triangle (polygon), drawing, sizing, and rotation programme using linked lists... | promsan | C Programming Language | 12 | 14-May-2007 15:03 |
| Doubly linked lists in C++ | sweeeeeeetlipss | C++ Forum | 1 | 24-Oct-2006 00:27 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 14:12 |
| help on linked lists any1????? | nick4 | C Programming Language | 1 | 17-May-2004 10:32 |
| linked lists, newbie needs help | moltarim | C Programming Language | 4 | 06-May-2004 12:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The