Omnimaga

Calculator Community => TI Calculators => Calculator C => Topic started by: Jonson26 on October 13, 2017, 04:32:23 pm

Title: TIGCC kbd_queue problem
Post by: Jonson26 on October 13, 2017, 04:32:23 pm
Well, I started into tigcc  programming, and i am unable t compile this example. Has anyona an idea why?
Code: [Select]
#include <tigcclib.h>

void _main(void) {
    void *kbq = kbd_queue();
    unsigned short key;
    unsigned long count = 0;

    // clear the screen
    clrscr();

    // print the string telling the user to press a key
    printf("Please press a key.\n");

    // while no key was retrieved from the keyboard queue
    while (OSdequeue(&key, kbq)) {
        // increment the variable number by one
        printf("Queue Check: %lu.\n", count);
        ++count;
    }
   

    // tell them what key they pressed
    printf("The keycode was %hu\n", key);

    // wait for input before exiting
    ngetchx();
}
Title: Re: TIGCC kbd_queue problem
Post by: Eeems on October 14, 2017, 01:39:56 pm
It would help if you included the compiler output.
Title: Re: TIGCC kbd_queue problem
Post by: Jonson26 on October 14, 2017, 04:16:28 pm
Well.. I only get this one error:
Quote
Unresolved reference to 'OSdequeue'.
Title: Re: TIGCC kbd_queue problem
Post by: 123outerme on October 14, 2017, 05:07:42 pm
Well.. I only get this one error:
Quote
Unresolved reference to 'OSdequeue'.
That usually signifies a missing -l(library) argument, forgetting to #include something, not having the library files in the right places, or the PATH variables being wrong. Try any of those things and you'll probably fix it.
Title: Re: TIGCC kbd_queue problem
Post by: TravisE on October 14, 2017, 08:05:34 pm
Are you using TIGCC, or GCC4TI? What version is it, how is your environment set up, and how are you running the compiler?

I have no problem compiling the example myself with GCC4TI on the command line in my Linux system (after adding the appropriate #define USE_TI89/USE_TI92PLUS/USE_V200 lines to the source). It's possible your installation or setup may be misconfigured somehow.
Title: Re: TIGCC kbd_queue problem
Post by: Jonson26 on October 16, 2017, 01:08:34 pm
Sorry for the slow response time (school & stuff). I'm on WinXP pro sp3 and I'm using TIGCC v 0.98 Beta. I installed it using an exe installer.
Edit: Re-installed Tigcc as 0.95 (non-beta). I still get hte same error, though.
Edit 2: I tried gcc4ti. Didn't work neither. Maybe i'll try it on win7?
Title: Re: TIGCC kbd_queue problem
Post by: Jonson26 on October 27, 2017, 01:54:59 pm
So... I tried it on windows 7. Guess what? I got exactly the same error...  :-\
Oddly enough, if i download the project folder directly from technoplaza, then it does indeed compile...
I'm really perplexed....

Just to be sure: the code i use in the project i created is exactly the same...



BIG Change (that's why i decided to make a standalone post):
After i added #define USE_V200 at the beginning it somehow worked ;D... Still, it's something VERY odd.

Edit (Eeems): Merged double post
Title: Re: TIGCC kbd_queue problem
Post by: TravisE on October 27, 2017, 05:10:26 pm
It may have to do with the project settings, if you're using the IDE and .tpr files. I'm no longer familiar with that since on Linux, TIGCC/GCC4TI comes as a command-line tool only (there used to be the KTIGCC IDE, but it uses obsolete KDE 3 libraries that have not been available in popular distros for ages).

I do seem to recall that the compiler can be picky about including the proper constants in the source files like one or more of USE_TI89/USE_TI92PLUS/USE_V200, and sometimes MIN_AMS (if you're using features introduced after the very first AMS 1.01 version).

On an unrelated note, I would recommend sticking with GCC4TI, as it was updated much more recently than TIGCC. The latest version of TIGCC I know of was released an entire decade ago.