_main not defined error

Discussion about other targets
Post Reply
spt
New member
Posts: 1
Joined: Tue Aug 03, 2021 4:41 am

_main not defined error

Post by spt »

can anyone shed a bit of light on this form me, as I now have a bit more time to play with z88dk.

got this error after a compile,
z88dk comp error.PNG
here is my test c

Code: Select all

// Jupiter Ace test of using C and asm Z80
// with z88dk.
// this file is saved in location
// J:\ace_c\ ... change to your own location
//
// zcc +ace -o j:\ace_c\example_1\ex-1.bin j:\ace_c\example_1\example-1.c
//                 ^^^^^^^^                   ^^^^^^^^
//                 target dir                 source dir
//
// a file called ex-1.bin will be created
// inport into 81 with memblock
// 
// at address 16384. then in forth '16384 CALL' 
//



#include <stdio.h>

// Function prototypes:
static void main(void); 
static void yourname(void); 
static void isace(void);

void main()
{
	#asm
	// clear Ace screen
	call 2589
	SET 4,(IX+62) // turn off OK message 
	#endasm
// Calls our functions:

yourname();
isace();
return;
}

// functions
void yourname()
{
	printf("Jupiter ACE Z88dk test.\n");
}

void isace()
{
	printf("Ace its worked!\n");
}

[\code]
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: _main not defined error

Post by dom »

It’s complaining because the linker can’t find the main function. This function needs to be globally accessible - in your example you’ve marked it as static.
Post Reply