assembly - Warning: Function must be extern error in C -
i following along tutorial c programming in 6502 assembly , having great deal of difficulty on 3rd step. when compiling code in command line, these errors:
test4.c(8): error: '{' expected
test4.c(9): warning: function must extern
test4.c(9): error: ';' expected
test4.c(13): error: '}' expected
i using program compile .c files made in code::blocks .nes files. current tutorial having me make .s assembly file when compiling in cl65 command line in windows program compiling it. here link tutorial page on: https://helloacm.com/tutorial-3-c-programming-in-6502-using-assembly/
i have tried many different combinations of code can think of try , rid of least of problems, alas no avail. amateur in c, use c++ cannot , still trying figure out. not able find "function must extern" error anywhere quick google search either. have idea what's going on?
here how wrote code in code::blocks:
void main() { asm("nop"); } void testasm() void main() { while(1) { testasm(); // call assembled function } }
also, had difficult time following along on particular tutorial part.
thanks in advance, appreciated on diagnosing problem!
perhaps you're after?
void testasm() { asm("nop"); } void main() { while(1) { testasm(); // call assembled function } }
your code had 2 main()
functions, , prototype void testasm()
no terminating semicolon.
alternatively, if testasm
written in assembly, code should (removing main
function):
extern void testasm(); // `extern` not required, may // particular compiler void main() { while(1) { testasm(); // call assembled function } }
you need more careful writing code.
Comments
Post a Comment