Harry Potter Posted March 12, 2023 Share Posted March 12, 2023 Hi! I am working on my AdvSkel65 program and gained considerable ground with debugging and optimizing. However, the 64k AtariXL port is giving me an error message on a line containing "offsetof" and is stating that it is an undefined function. I also get two errors immediately after: one says that I can't mix declarations and code, and the other says that cc65 expects an integer expression. Following are gthe troublesome function declaration: ------------------------- //Second part of player init routine. To be stored in a stub. void InitPlayer2 (void) { //for (i=8; i;) {--i; Player.Inv[i]=Player.ExitRoom=-1;} memset (&Player, 0, sizeof(Player)); __asm__ ( "\tlda\t#255\n" "\tldx\t#7\n" "@a01:\n" //"\tinc\t$C00\n" "\tsta\t%v+%w,x\n" "\tdex\n" "\tbpl\t@a01\n", Player, offsetof (struct player_, Inv) ); #if defined __C128__ || defined __APPLE2ENH__ printscr("What is your name? (No more\n" "than 15 characters)?"); GetInput (Player.Name, 15); #endif //Player.ExitRoom=-1; //Player.Money =2000; #ifdef __USEFARMEM__ #if defined __APPLE2ENH__ || defined __ATARIXL__ aux_memcpyfrom (&Player.RoomInv, &DefRoomItems, (NumItems<<3)); #elif defined __PLUS4__ || defined __C128__ bank1_memcpyfrom (&Player.RoomInv, &DefRoomItems, (NumItems<<3)); //bank1_memcpyfrom (0xC00, &DefRoomItems, (NumItems<<3)); #elif defined __C64__ hmemcpy (&Player.RoomInv, &DefRoomItems, (NumItems<<3)); #else memcpy (&Player.RoomInv, &DefRoomItems, (NumItems<<3)); #endif #else memcpy (&Player.RoomInv, &DefRoomItems, (NumItems<<3)); #endif CRoom=0; //printc ('.'); } ----------------------- and the line to compile the code: ------------------------------ cl65 --cc-args --all-cdecl -C atarixl_small.cfg -t atarixl -Wl -D__SYSTEM_CHECK__=1 -Cl -Ors -o autorun.sys atari8_crt0.s player.c rooms.c words.c wordsdb.c wordsdb2.c printtok.c printi.s atasimpleio_xl.lib ataricio.lib Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted March 13, 2023 Share Posted March 13, 2023 A clue could be that offsetof isn't a function, so check that stddef.h is included: https://www.cc65.org/doc/funcref-161.html Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted March 13, 2023 Author Share Posted March 13, 2023 Okay. I'll try that now. Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted March 13, 2023 Author Share Posted March 13, 2023 It worked! Thanks! Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted March 13, 2023 Share Posted March 13, 2023 How do the other targets work then? Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted March 13, 2023 Author Share Posted March 13, 2023 I don't know, but they were, and now, the problem is fixed. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted March 13, 2023 Share Posted March 13, 2023 would be worth tracing why as if the include is commented out then it should not work for other platforms. it implies that stddef is being included elsewhere for other platforms but not the Atari Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted March 13, 2023 Author Share Posted March 13, 2023 Well...the 128k Atari XL version compiled successfully. But it works now. Quote Link to comment Share on other sites More sharing options...
sanny Posted March 13, 2023 Share Posted March 13, 2023 40 minutes ago, Wrathchild said: would be worth tracing why as if the include is commented out then it should not work for other platforms. it implies that stddef is being included elsewhere for other platforms but not the Atari My impression is that @Harry Potter isn't caring why something is working or not. When it is working he is happy 🙂 1 1 Quote Link to comment Share on other sites More sharing options...
+Stephen Posted March 13, 2023 Share Posted March 13, 2023 48 minutes ago, sanny said: My impression is that @Harry Potter isn't caring why something is working or not. When it is working he is happy 🙂 It's an unfortunately all too common coding style called "throw shit at the wall and see what sticks" 2 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.