z88dk forums

z80 Development Kit

You are not logged in.

#1 2011-08-26 01:20:01

Zetr0
New member
Registered: 2011-08-22
Posts: 7

Error Compiling: (yes... sorry... another one..)

Hello there my fellow Z88dk'ers

now... I was about to settle in and play with some SP1 sprite handling (as printf is simply NOT fast enough for my project)

However before I could get started in some code - everything I attempted to compile I receving an "Unexpected end of file error"

Now as always I step back to the basic and work forward - so I wrote a simple "hello world"


Simple Program: program.c

Code:

#include <stdio.h>

void main( void )
{
    printf("Hello World");
}

I used this complile line

Code:

zcc +zxansi -lndos -DPLUS3 -lm -create-app program.c >build.txt

Here is the error

Code:

sccz80:"program.c"L:6 Error:#1:Unexpected end of file
Compilation aborted

I have tried this a few times and still the same result... interestingly my other menu-handling seems to still complie with the above line.


Code:

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <sound.h>

#include "toolbox.h"

/* G L O B A L   V A R S -------------------------------------------- */

char play_sound;                          /* to turn sound on and off */

/* S T R U C T U R E S ---------------------------------------------- */


struct menu_item sm_item[10];
struct menu_window sm_window;


/* F U N C T I O N S ---------------------------------------------- */

void input_menu( void );
void store_menu(char title[21], int x, int y, int hi_bcol, int hi_tcol, int lo_bcol, int lo_tcol, int rec_num);


/* M A I N ---------------------------------------------------------- */

void main( void )
{
     int i, moption=0;
     char ch=0;

     play_sound=1; /* on */

     clear_screen(7,0);

     print_at( 1,1,6,0,"Initializing Menu System");

     input_menu();

     print_at( 1,2,6,0,"Menu System Initialized ");

     for( i =0; i < 10 ;i +=1)
     {
          print_at(sm_item[ i ].x, sm_item[ i ].y, sm_item[ i ].lo_bcol, sm_item[ i ].lo_tcol, sm_item[ i ].title);
     }

     while( ch !=13 )
     {
            print_at(sm_item[ moption ].x, sm_item[ moption ].y, sm_item[ moption ].hi_bcol, sm_item[ moption ].hi_tcol, sm_item[ moption ].title);

            ch = getch();

            if( play_sound )bit_click();

            if( ch == cursor_up)
            {
                print_at(sm_item[ moption ].x, sm_item[ moption ].y, sm_item[ moption ].lo_bcol, sm_item[ moption ].lo_tcol, sm_item[ moption ].title);
                moption -=1;
                if( moption <0) moption =9;
            }

            if( ch == cursor_down)
            {
                print_at(sm_item[ moption ].x, sm_item[ moption ].y, sm_item[ moption ].lo_bcol, sm_item[ moption ].lo_tcol, sm_item[ moption ].title);
                moption +=1;
                if( moption > 9 ) moption =0;
            }

            if( ch == 's' || ch == 'S')    /* turn sound click off / on
            {
                if(play_sound)
                {
                     play_sound = 0;
                }
                else
                {
                     play_sound = 1;
                }
            }
     }

}

/* F U N C T I O N S ------------------------------------------------ */

void input_menu( void ) /*quickly has a random set of menu items */
{
     store_menu("Option 1      \0", 10, 7, cyan, black, white, black,0);
     store_menu("Castle Master \0", 10, 8, cyan, black, white, black,1);
     store_menu("JumpStreet    \0", 10, 9, cyan, black, white, black,2);
     store_menu("Elite Space   \0", 10, 10, cyan, black, white, black,3);
     store_menu("Gimp Rider    \0", 10, 11, cyan, black, white, black,4);
     store_menu("Option 2      \0", 10, 12, cyan, black, white, black,5);
     store_menu("Option 3      \0", 10, 13, cyan, black, white, black,6);
     store_menu("Hex Loader    \0", 10, 14, cyan, black, white, black,7);
     store_menu("Binary Counter\0", 10, 15, cyan, black, white, black,8);
     store_menu("Option 99     \0", 10, 16, cyan, black, white, black,9);
}

void store_menu(char title[21], int x, int y, int hi_bcol, int hi_tcol, int lo_bcol, int lo_tcol, int rec_num) /* change this for parsing a structure!*/
{
     int i;
     for( i=0; i < 21; i +=1 )
     {
          if( title[ i ] == '\0')
          {
              sm_item[ rec_num ].title[ i ] = '\0';
              i = 21;
          }
          else
          {
              sm_item[ rec_num ].title[ i ] = title[ i ];
          }
     }

     sm_item[ rec_num ].x = x;
     sm_item[ rec_num ].y = y;
     sm_item[ rec_num ].hi_bcol = hi_bcol;
     sm_item[ rec_num ].hi_tcol = hi_tcol;
     sm_item[ rec_num ].lo_bcol = lo_bcol;
     sm_item[ rec_num ].lo_tcol = lo_tcol;
}

This compliles fine without any error on the above compile line.

I have tried again uninstalling and then re-installings z88dk, rebooted the machine and still no joy as to what the problem(s) could be.

Thanks again for reading.... I do seem to be stuck on the fringes at the moment.

Offline

 

#2 2011-08-29 12:00:50

stefano
Administrator
Registered: 2007-07-16
Posts: 696

Re: Error Compiling: (yes... sorry... another one..)

I guess it is my turn to post a feedback, but this one seems easy..  just try adding a newline at the enf of the program.

Offline

 

#3 2011-08-29 17:01:51

Zetr0
New member
Registered: 2011-08-22
Posts: 7

Re: Error Compiling: (yes... sorry... another one..)

@stefano

thanks for reading this thread, I appreciate it.

Indeed it did turn out to require just one more CR at the end of the text file...  the irony is I was thinking that there was some hidden character token at the end of the file - but no... a simple return would of save a few hours of head ache LOL.

With a bit of luck I shall be enjoying some SP1 tonight!!!!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson