Error: Undefined reference to function

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
MisterHemi
Member
Posts: 12
Joined: Tue Jun 19, 2018 1:21 am

Error: Undefined reference to function

Postby MisterHemi » Mon Jan 06, 2020 1:59 am

Hello,

I've searched the forum and didn't find anything seemingly relevant to my problem.

I get the following errors:

Code: Select all

Creating I2C Display Library v2.xe
cd .build && xcc  -O2 -g    @_obj.rsp '.././XCORE-200-EXPLORER.xn'   '.././config.xscope' -o '../bin//I2C Display Library v2.xe'
../src/main.xc: Error: Undefined reference to 'initDisplayType4004'
../src/main.xc: Error: Undefined reference to 'messagesDisplay'
xmake[1]: *** [bin//I2C Display Library v2.xe] Error 1
xmake: *** [bin//I2C Display Library v2.xe] Error 2
I have included the header file which declares the functions and they are defined.
The code is as follows:

Code: Select all

#include "main.h"
#include "I2C_Services.h"
#include "DisplaysI2C.h"
#include "ErrorCodes.h"

int main(){

    interface I2Cbus busI2C;
    interface I2C initDisp;
    interface I2C updateDisp;
    chan I2c1Stat;
    chan messageStat;

        par {
            on tile[0]: initialization(busI2C);
            on tile[0]: serveI2C(busI2C, initDisp, updateDisp);
            on tile[0]: displayUpdate(I2c1Stat, messageStat);
            on tile[0]: updateStatusLEDs(messageStat);
        }

    return 0;
}

void initialization(interface I2Cbus client busI2C){
    startState = 0;
    interface I2C initDisp;

    while(1){
        switch (startState) {
            case 0:{
                busI2C.init();
                startState = 1;
                break;
            }

            case 1:{
                initDisplayType4004(Address1, dispMode, initDisp);
                initDisplayType4004(Address2, dispMode, initDisp);
                startState = 2;
                break;
            }

            case 2:{
                messagesDisplay();
                break;
            }

        } // End switch
    } // End while
}
I have no clue why this happens. I'm guessing it's some type of linker error?

I'm using xTIMEcomposer Community_14.3.3 (build 22296, Apr-19-2018) on MacOS Mojave 10.14.6
User avatar
CousinItt
XCore Addict
Posts: 176
Joined: Wed May 31, 2017 6:55 pm

Postby CousinItt » Mon Jan 06, 2020 3:12 pm

You have to tell the compiler where to find the headers, if they aren't in the same folder.

Otherwise the problem might be fixed by a clean build.
User avatar
MisterHemi
Member
Posts: 12
Joined: Tue Jun 19, 2018 1:21 am

Postby MisterHemi » Mon Jan 06, 2020 11:41 pm

Thanks. The headers are all in the same folder.

I believe I tried a clean build before. I'll try again.
User avatar
MisterHemi
Member
Posts: 12
Joined: Tue Jun 19, 2018 1:21 am

Postby MisterHemi » Fri Jan 10, 2020 10:36 am

After a clean build I now get the following message:

Code: Select all

/src/main.xc:29:9: error: use of `usage.anon.6' violates parallel usage rules
        par {
        ^~~
What is "usage.anon.6"?

Is there a list on error codes/messages or some reference which list such things?
User avatar
CousinItt
XCore Addict
Posts: 176
Joined: Wed May 31, 2017 6:55 pm

Postby CousinItt » Sat Jan 11, 2020 6:27 pm

See here: viewtopic.php?t=3385, especially the comment by ers35. I think you have a similar problem.

I don't know where there's a list of error codes, but the text is usually fairly clear.
User avatar
MisterHemi
Member
Posts: 12
Joined: Tue Jun 19, 2018 1:21 am

Postby MisterHemi » Sun Jan 12, 2020 6:36 pm

Thanks, i'll take a look.

Who is online

Users browsing this forum: No registered users and 6 guests