Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 22
Registered: ‎02-02-2012
My Device: none
My Carrier: none

'Conflicting types' issue in porting Qt application

[ Edited ]

I think it's simple problem. I am porting my Qt application, where I have following plain C methods:

 

uint64_t rand64_r(struct drand48_data* rnd_buf) {
    uint64_t buff = 0;
    lrand48_r(rnd_buf, &buff);
    uint64_t res = buff << 32;
    lrand48_r(rnd_buf, &buff);
    res = res + buff;
    return res;
}

uint32_t rand32_r(struct drand48_data* rnd_buf) {
    long buff = 0;
    lrand48_r(rnd_buf, &buff);
    return buff;
}

 But when I'm trying to build it NDK I get following:

warning: 'struct drand48_data' declared inside parameter list
error: conflicting types for 'rand64_r'
warning: 'struct drand48_data' declared inside parameter list
error: conflicting types for 'rand32_r'

Could anybody point me what I'm doing wrong?

Highlighted
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: 'Conflicting types' issue in porting Qt application

I tried to reproduce this compiler warning but haven't succeeded.

As I understand it, this warning is for structures actually declared in the parameter list, which is not what you're showing in your code snippet.

 

Are you still having an issue?

If so, can you show the relevant include files, and any other declarations of your routines?

Developer
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook
My Carrier: None

Re: 'Conflicting types' issue in porting Qt application

Are you missing a include for drand48_data? It complains about it is not declared.

Contributor
Posts: 22
Registered: ‎02-02-2012
My Device: none
My Carrier: none

Re: 'Conflicting types' issue in porting Qt application

I've found out that stdlib.h in NDK does not contain the lrand48_r definition, so I replaced it with lrand48 and removed drand48_data from parameters.