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
Developer
Posts: 297
Registered: ‎10-30-2010
My Device: PlayBook
My Carrier: other
Accepted Solution

Linker error: undefined reference to mmr_*

[ Edited ]

The IDE is beyond convoluted Man Indifferent,

How can I add an additional library to the linker?

 Is the library -lmmrndclient ?

 

Help? 

 

C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:46: undefined reference to `mmr_error_info'
src\main.o: In function `main':
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:164: undefined reference to `mmr_connect'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:166: undefined reference to `mmr_context_create'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:168: undefined reference to `mmr_output_attach'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:170: undefined reference to `mmr_output_parameters'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:172: undefined reference to `mmr_input_attach'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:174: undefined reference to `mmr_play'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:235: undefined reference to `mmr_stop'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:236: undefined reference to `mmr_input_detach'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:237: undefined reference to `mmr_context_destroy'
C:\PlayBookProjects\SoundTest\Device-Debug/..\src/main.c:238: undefined reference to `mmr_disconnect'

 

Developer
Posts: 297
Registered: ‎10-30-2010
My Device: PlayBook
My Carrier: other

Re: Linker error: undefined reference to mmr_*

[ Edited ]

Resolved: Had to link against:

 

\bbndk-1.0\target\qnx6\armle-v7\lib\libmmrndclient.so

 

In project settings, under Paths and Symbols -> Libraries

Developer
Posts: 580
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: Linker error: undefined reference to mmr_*

Thanks. I was copying and pasting some code for loading an image from the Gesture sample app and was getting a similar error.

 

Are there tutorials that explain his subject matter?

Contributor
Posts: 23
Registered: ‎05-29-2012
My Device: Blackberry Playbook Os 2.0
My Carrier: Robi Axiata Limited

Re: Linker error: undefined reference to mmr_*

I am having the exact problems. I am working on windows 7 and the add library option is not avilable. How can I solve this issue?

Contributor
Posts: 23
Registered: ‎05-29-2012
My Device: Blackberry Playbook Os 2.0
My Carrier: Robi Axiata Limited

Re: Linker error: undefined reference to mmr_*

To make the question more specific. I am posting the code here.

 

#ifndef SOUNDPLAYER_H_
#define SOUNDPLAYER_H_

#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <bps/bps.h>
#include <bps/audiomixer.h>
#include <bps/dialog.h>
#include <bps/navigator.h>
#include <mm/renderer.h>

class SoundPlayer
{
private:
const char *ctxt_name;
const char *audio_out;
const char *input_type;
char cwd[PATH_MAX];
char input_url[PATH_MAX];
int audio_oid;
mode_t mode; // S_IRUSR indicates read permission & S_IXUSR indicates execute/search permission
mmr_connection_t *connection;
mmr_context_t *ctxt;
public:
SoundPlayer(char *filename);
void play();
void stop();
~SoundPlayer();


};


#endif /* SOUNDPLAYER_H_ */

 

 

 

# include "SoundPlayer.h"

 


SoundPlayer:Smiley FrustratedoundPlayer(char *filename)
{
ctxt_name = "testplayer";
audio_out = "audio:default";
input_type = "track";

mode = S_IRUSR | S_IXUSR; // S_IRUSR indicates read permission & S_IXUSR indicates execute/search permission

getcwd(cwd, PATH_MAX);
snprintf(input_url, PATH_MAX, "file://%s%s", cwd, filename);

connection = mmr_connect(NULL);
ctxt = mmr_context_create(connection, ctxt_name, 0, mode);

audio_oid = mmr_output_attach(ctxt, audio_out, "audio");
mmr_output_parameters(ctxt, audio_oid, NULL);
mmr_input_attach(ctxt, input_url, input_type);
// Perform other application tasks here

}


void SoundPlayer:Smiley Tonguelay()
{
mmr_play(ctxt);
}


void SoundPlayer::stop()
{
mmr_stop(ctxt);
mmr_input_detach(ctxt);
mmr_context_destroy(ctxt);
mmr_disconnect(connection);
}


SoundPlayer::~SoundPlayer()
{
delete ctxt_name;
delete audio_out;
delete input_type;
delete input_url;
delete input_type;
delete cwd;
}

 


int main()
{
SoundPlayer *sound = new SoundPlayer("test.mp3");
sound->play();
}

 

 

This is a make file project and the errors are:

E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:17: undefined reference to `mmr_connect'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:18: undefined reference to `mmr_context_create'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:20: undefined reference to `mmr_output_attach'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:21: undefined reference to `mmr_output_parameters'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:22: undefined reference to `mmr_input_attach'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:17: undefined reference to `mmr_connect'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:18: undefined reference to `mmr_context_create'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:20: undefined reference to `mmr_output_attach'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:21: undefined reference to `mmr_output_parameters'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:22: undefined reference to `mmr_input_attach'
SoundPlayer.o: In function `SoundPlayer:Smiley Tonguelay()':
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:30: undefined reference to `mmr_play'
SoundPlayer.o: In function `SoundPlayer::stop()':
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:36: undefined reference to `mmr_stop'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:37: undefined reference to `mmr_input_detach'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:38: undefined reference to `mmr_context_destroy'
make[2]: Leaving directory `E:/BlackBerryPlaybook/TestSound2/arm/o.le-v7-g'
E:/BlackBerryPlaybook/TestSound2/SoundPlayer.cpp:39: undefined reference to `mmr_disconnect'

Contributor
Posts: 22
Registered: ‎03-07-2012
My Device: PlayBook, Dev Alpha
My Carrier: Sosh (Orange FR)

Re: Linker error: undefined reference to mmr_*

I'm having exactly the same problem here.

Adding the .so in the Includes of "Paths & Symbols" don't change anything, even the compiler keep saying :

"note: 'mmr_connect' is defined in DSO M:/BBOS10-NDK/target/qnx6/armle-v7/lib/libmmrndclient.so.1 so try adding it to the linker command line"

____________________________________
BB10 developer thanks to the PlayBook offer.
Waiting for my Z10 LE now !
Contributor
Posts: 23
Registered: ‎05-29-2012
My Device: Blackberry Playbook Os 2.0
My Carrier: Robi Axiata Limited

Re: Linker error: undefined reference to mmr_*

Problem solved. If you are working in windows then right click the project in project explorer. From there select configuration and from nested menu select add library. From the add library wizard select add external library and add mmrndclient.so and strm.so in your project. This is what you have to do for managed build. For makefile build you have to do a couple of things manually, just follow the instruction given by the ide.Smiley Happy

Contributor
Posts: 22
Registered: ‎03-07-2012
My Device: PlayBook, Dev Alpha
My Carrier: Sosh (Orange FR)

Re: Linker error: undefined reference to mmr_*

I don't acheive the "edit makefile" part explained by the IDE...

I know where the Device.Debug's Makefile is, but i don't know where to put the new args to -l and -L !

____________________________________
BB10 developer thanks to the PlayBook offer.
Waiting for my Z10 LE now !
Contributor
Posts: 23
Registered: ‎05-29-2012
My Device: Blackberry Playbook Os 2.0
My Carrier: Robi Axiata Limited

Re: Linker error: undefined reference to mmr_*

well its easy.there is a file common.mk. add the libraries there in this fashion manually.

LIBS+= mmrndclient\
strm

you can add as many as you need. Smiley Happy