putchar() from kernel.h clobbered by stdio.h

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
fluke
Posts: 25
Joined: Mon Jul 26, 2004 7:00 am

putchar() from kernel.h clobbered by stdio.h

Post by fluke »

I ran into a problem where the pre-compiler clobbered the proto for putchar() from kernel.c

What came form the include was in ps2sdk/ee/kernel.h line 272:
int putchar(int c);

After the pre-compiler used the defines from ps2dev/ee/ee/include/stdio.h the result was:
int (--((_impure_ptr->_stdout))->_w < 0 ? ((_impure_ptr->_stdout))->_w >= ((_imp
ure_ptr->_stdout))->_lbfsize ? (*((_impure_ptr->_stdout))->_p = (int c)), *((_im
pure_ptr->_stdout))->_p != '\n' ? (int)*((_impure_ptr->_stdout))->_p++ : __swbuf
('\n', (_impure_ptr->_stdout)) : __swbuf((int)(int c), (_impure_ptr->_stdout)) :
(*((_impure_ptr->_stdout))->_p = (int c), (int)*((_impure_ptr->_stdout))->_p++)
);

This finally results in a fatal compiler error that a parse error occured before '--' token.
If I comment out the proto from the kernel header file then the compiler complettes.
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Yeah... there's always a conflict between the "ps2sdk's libC" and the "newlib"... ho well :)
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

There shouldn't be any conflicts. putchar() should be moved to stdio.h in ps2sdk, and if you want to use newlib's stdio.h use angle brackets <>, but if you want to use ps2sdk's stdio.h use quotes and make sure the include path to ps2sdk's stdio.h is among the first in the -I flags.
Post Reply