![]() |
|
#1
|
|||
|
|||
Back to the drawing board...Hi again. Can you believe the scale and number of projects i have?
This one so far is ok - I think i should be able to get most of it done myself, basically its to create a grid, and then "draw" with asterix's on it. Thing is i thought i'd take the oppurtunity to play with header files. Now i'm getting an error : error C2143: syntax error : missing '{' before 'PCH creation point' (using visual C++) and i don't think it is the header file, cause i'f i comment out the header file i still have the error, but it wasn't there until i added the header file. Any ideas? whats the PCH? its before even any functions have gone through so i dont know why its missing a {... Many thanks Mitch CPP / C++ / C Code:
Code:
__________________
War doesn't say who's right, only who's left... |
|
#2
|
||||
|
||||
|
CPP / C++ / C Code:
Spud. I think the error may be in your header file. The line I showed needs a semicolon so that C knows that it is a function decleration and not the start of the function itself. |
|
#3
|
|||
|
|||
|
Quote:
Cheers, that solved my error, though on runing it is crashing now. Anyway, thanks for looking, brilliant! Cheers M __________________
War doesn't say who's right, only who's left... |
|
#4
|
|||
|
|||
|
Quote:
Look at the following (in create_grid()): Code:
What is the value of x_size? Did you mean to set it to GRID_SIZE_X? (Also look at y_xsize in its malloc() statement.) I think it should get through create_grid() with these couple of fixes. Regards, Dave |
|
#5
|
|||
|
|||
|
Quote:
Thats just me changing variables and not checking through them to make sure they're the same Thanks Dave, kinda pissed at myself for not seeing it. Cheers again Mitch __________________
War doesn't say who's right, only who's left... |
|
#6
|
|||
|
|||
|
CPP / C++ / C Code:
why is this erroring? I'm getting c:\programming\ee1e2\drawing\main.c(143) : warning C4013: 'print_grid' undefined; assuming extern returning int c:\programming\ee1e2\drawing\main.c(143) : warning C4047: '=' : 'struct position ** ' differs in levels of indirection from 'int ' c:\programming\ee1e2\drawing\main.c(177) : error C2040: 'print_grid' : 'struct position **(struct position ** ) ' differs in levels of indirection from 'int ()' c:\programming\ee1e2\drawing\main.c(206) : warning C4047: '=' : 'struct position ** ' differs in levels of indirection from 'int ' Error executing cl.exe. all of the above due to that function, or specifically a call to that function from CPP / C++ / C Code:
why is it assuming its returning an int when i say it should return the pointer? if i remove ( or comment out ) the line marked above, the program runs fine. I realise I'm calling a function from within a function, but I'm only passing through a pointer that is already called in the initial function and returning it. I've tried passing the grid pointer and not returning anything (cause i dont really need to) but that was still causing the same error (hence me trying with returning the pointer) I think i had v similar trouble with the mars rover project (which i still need to do, orgh) but i still don't understand where the problem lies. If anyone could have a quick glance at it. Many thanks. Mitch __________________
War doesn't say who's right, only who's left... |
|
#7
|
|||
|
|||
|
Quote:
In your original post, print_grid(), and the call to it, was commented out. Now, if you haven't changed its position in your source file, print_grid() is defined after negative_image() invokes it. The warning that I have included above tells you something: Whenever C encounters a function that it does not know anything about, it assumes it returns int, and it assumes that all arguments are int. Put a prototype declaration of print_grid() somewhere in the file before the function's first invocation: Code:
Then look at other compiler messages, work through them one at a time. Cheers! Dave |
|
#8
|
|||
|
|||
|
Quote:
I've included a function declaration in the header - sorted out the problem. I don't know why i didn't see it, sorry to bug you with the little things i should have noticed myself. Cheers, again. Mitch __________________
War doesn't say who's right, only who's left... |
|
#9
|
|||
|
|||
|
Quote:
A few times through the crash/burn loop, and you will find easier spot the significant compiler messages (sometimes known as picking the fly specks out of the pepper). I personally like to eliminate all warnings (within reason), or, at least make sure I understand what it is that I am ignoring. [edit] Does you mean that you found your bug(s) in neg_image() and print_grid()? [/edit] Dave "I was born not knowing, and have only had a little time to change that, here and there." --- Richard P. Feynman Last edited by davekw7x : 15-Mar-2004 at 10:09.
|
|
#10
|
|||
|
|||
|
Quote:
Feynman - Genius. Indeed, I am learning. And I'm getting better at the debugging process. The only warning i get now i know why its there and that its ok to ignore. I'll try to quit asking the easy questions - I'm getting there slowly. Cheers again, Mitch __________________
War doesn't say who's right, only who's left... |
Recent GIDBlog
Developing GUIs with wxPython (Part 3) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Free message board hosting, 30 skins, 11 languages. | edkhosting | Free Web Hosting | 1 | 27-Feb-2004 13:14 |
| This message board | nniehoff | Web Design Forum | 4 | 20-Aug-2001 02:22 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The