How to link to phexlib library?

Hi,
I’m very new to QNX. I’m trying to use the PxLoadImage to display some images, but I found out I have to link to the phexlib to use PxLoadImage.
I tried looking at the Makefile that was produced by QNX Momentics, but can not discipher it. How do I link to the phexlib? Can someone please help me? What do I have to do to link to this library and how?
The following is what is in my Makefile:
LIST=CPU
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif
include $(QRDIR)$(QRECURSE)

Am I completely off by thinking I have to specify the library in the makefile?

Any advice on how to do link to libraries is greatly appreciated.

Thank in advance,

Phishsaw

Go into PhAb’s ‘Properties…’ window (Project menu) and add -lphexlib in the Libraries field in build & run options. That should do it.

Thank you thegman for your response.

I’m not using PhAb, i’m trying to write and “simple” qnx c program using PxLoadImage() to display some images on my target board. I’m not having much luck with linking the library within the IDE, but I am able to do it at the command line. However, I’d like to be able to link to the phexlib within the IDE because it’s easier to debug.

My PxLoadImage could not load image either! I keep getting some memory error Here is the code:

int main(int argc, char *argv[]) {

PhImage_t * demoImage;
printf("Welcome to the Momentics IDE\n");
demoImage = PxLoadImage("navigation.jpg", NULL);
printf("1");
PxTerminate( demoImage );

if (demoImage == NULL)
{

    fprintf( stderr, "Error loading/query %s\n", demoImage);
    PtExit( EXIT_FAILURE );
}


return EXIT_SUCCESS;

}

/////////////////////////////////
This is the output:
[/tmp]# LoadImage
Welcome to the Momentics IDE
Error loading/query
Process 1241113 (LoadImage) terminated SIGSEGV code=1 fltno=11 ip=70341fa6 mapaddr=00040fa6. ref=00000000
Memory fault

Any help would be greatly appreciated.

Thank you again!

I’m afraid I can’t help you with the IDE, as I never use it, and my license has expired. For the PxLoadImage call, what you have looks OK, except that you have not stated a full path to the file, which might not help, and the PxTerminate call is not required.

Also your fprintf call is giving NULL as the string, which it may not like. demoImage is effectively an opaque pointer, so the only way to print it would be with %p and not %s.

HTH

Garry

I suggest starting with the example in the 6.3.0 docs and then work back to your simpler case.

Hi Garry and evanh,
Thank you for your help. I really appreciate it. I’ll give it a shot tomorrow.
BTW, I did try the example from qnx 6.3.0. I get a “could not load image”. I’ll try again though.
Will give you posted.
Thanks,
Phishsaw