Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Code broken by a function... Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
JosephDuchesne

March 03, 2005, 06:13 PM

Hi, I have another problem. For some reason my function loadPlatformDep() isn't working. Whenever I put it where it currently is, it screws up the int declarations below it. I am running this on a windows machine, so the windows code is running. I can't figure out why it would work if it's below the declarations and why not if it's above. Here are the errors:

Compiling...
main.c
C:Program FilesMicrosoft Visual StudioMyProjectsMadTakmain.c(191) : error C2143: syntax error : missing ';' before 'type'
C:Program FilesMicrosoft Visual StudioMyProjectsMadTakmain.c(191) : error C2065: 'hmm' : undeclared identifier
C:Program FilesMicrosoft Visual StudioMyProjectsMadTakmain.c(194) : error C2143: syntax error : missing ';' before 'type'
C:Program FilesMicrosoft Visual StudioMyProjectsMadTakmain.c(195) : error C2143: syntax error : missing ';' before 'type'
C:Program FilesMicrosoft Visual StudioMyProjectsMadTakmain.c(196) : error C2065: 'bpp' : undeclared identifier
C:Program FilesMicrosoft Visual StudioMyProjectsMadTakmain.c(198) : error C2065: 'height' : undeclared identifier
Error executing cl.exe.

The forums won't let me post the source so I put it up here:
http://www.staronesw.com/temp/source.c.txt

 
Reedbeta

March 03, 2005, 06:47 PM

If your source code file is named .c, then I believe the compiler will work in C mode. This means all local variable declarations must occur at the beginning of the function. Try renaming the source file to .cpp and see if this clears it up.

 
Azu

March 08, 2005, 02:58 PM

try putting all preprocessor (#include) statements BEFORE the function.

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.