[SOLVED] Using libvlc.dll in VS 2005 (C++)

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
bsrealm
New Cone
New Cone
Posts: 6
Joined: 22 Mar 2008 12:05

[SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby bsrealm » 22 Mar 2008 12:14

Hello:

1: I do not know if this is the best place to post this topic. If not, I request you to move this to the appropriate place.
2: Ok, now to my problem. I got the include/ directory from the source tarball and then copied the libvlc.dll and plugins/* to my Debug/ folder in my VC++ console application.
3: I basically copy pasted the code from http://wiki.videolan.org/LibVLC_Tutorial_086c and it compiles well but when linking, I get the following error(s):

1>------ Build started: Project: LibVLC One, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>Linking...
1>Main.obj : error LNK2019: unresolved external symbol _libvlc_destroy referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _libvlc_playlist_play referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _libvlc_playlist_add referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _libvlc_new referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _libvlc_exception_init referenced in function _main
1>C:\Users\Balki\Documents\Visual Studio 2005\Projects\LibVLC Zero\Debug\LibVLC One.exe : fatal error LNK1120: 5 unresolved externals
1>Build log was saved at "file://c:\Users\Balki\Documents\Visual Studio 2005\Projects\LibVLC One\Debug\BuildLog.htm"
1>LibVLC One - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Please help. I have the folder in the linker additional directories too.


Thanks
Balki

Code:

#include <stdio.h>
#include <windows.h>
#include <vlc/libvlc.h>

int main(int argc, char **argv)
{
libvlc_exception_t excp;
libvlc_instance_t *inst;
int item;
char *myarg0 = "-I"; char *myarg1 = "dummy";
char *myarg2 = "--plugin-path=.\\plugins";
char *myargs[4] = {myarg0, myarg1, myarg2, NULL};
char *filename = "B:\\Videos\\TV\\HIMYM\\Season 1\\How I Met Your Mother - 1x01 - Pilot - hdtv-lol.[VTV].avi";

libvlc_exception_init (&excp);
inst = libvlc_new (3, myargs, &excp);
item = libvlc_playlist_add (inst, filename, NULL, &excp);
libvlc_playlist_play (inst, item, 0, NULL, &excp);
Sleep (10000);
libvlc_destroy (inst);
return 0;
}
Last edited by bsrealm on 22 Mar 2008 22:32, edited 1 time in total.

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: VLC in VS 2005 (C++)

Postby VLC_help » 22 Mar 2008 16:04

You need a .lib file (libvlc.lib). .dll files are for runtime, .lib files are for linking. If you have libvlc.lib in right place, remember to add it to your project.
http://csf11.acs.uwosh.edu/cs371/visual ... step4b.jpg
EDIT:
viewtopic.php?f=14&t=45260&p=143004&hilit=dll#p143004
that might help someone.

bsrealm
New Cone
New Cone
Posts: 6
Joined: 22 Mar 2008 12:05

Re: VLC in VS 2005 (C++)

Postby bsrealm » 22 Mar 2008 22:31

Thanks a lot VLC_help! I learnt a lot in the process as well.


Thanks,
Balki

isilinux
New Cone
New Cone
Posts: 4
Joined: 15 Apr 2008 10:12

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby isilinux » 28 Apr 2008 17:28

hi,
I have the same problem, but I dont know how add vlclib.dll to my program.
could you please help me in details?
thanks

bsrealm
New Cone
New Cone
Posts: 6
Joined: 22 Mar 2008 12:05

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby bsrealm » 28 Apr 2008 18:29

Hey, I gotta go somewhere now. I will reply as soon as I get back. Its an easy process. See ya in a bit.

isilinux
New Cone
New Cone
Posts: 4
Joined: 15 Apr 2008 10:12

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby isilinux » 29 Apr 2008 12:22

thank you very much
I am waitting you. :)
my main code is in following:

// vlc2Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "vlc2Dlg.h"
#include <string.h>
//#include "dshow.h"
#include <stdio.h>
#include "malloc.h"
#include "vlc.h"
#include "libvlc.h"
#include <windows.h>


#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
enum { IDD = IDD_ABOUTBOX };

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

// Implementation
protected:
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()


// Cvlc2Dlg dialog

Cvlc2Dlg::Cvlc2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(Cvlc2Dlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void Cvlc2Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(Cvlc2Dlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDOK, &Cvlc2Dlg::OnBnClickedOk)
ON_BN_CLICKED(IDC_BUTTON1, &Cvlc2Dlg::OnBnClickedButton1)
ON_BN_CLICKED(IDCANCEL, &Cvlc2Dlg::OnBnClickedCancel)
END_MESSAGE_MAP()


// Cvlc2Dlg message handlers

BOOL Cvlc2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here

return TRUE; // return TRUE unless you set the focus to a control
}

void Cvlc2Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void Cvlc2Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}

// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR Cvlc2Dlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}


/**********************************************************************
* loadLibrary: Carga la librería VLC
**********************************************************************/
int loadLibrary ( LPWSTR libreria) { //
LPCWSTR lib = L"\\libvlc.dll";
DWORD tamano = GetCurrentDirectoryW(0, NULL);
int liblen = lstrlenW(lib);

printf("Tamano: %d, %d\n", tamano, liblen);
LPWSTR buffer = new WCHAR[tamano + liblen];
tamano = GetCurrentDirectoryW(tamano, buffer);
//buffer[tamano] = 0;
lstrcatW(buffer, lib);
printf("Buffer: %S\n", buffer);

if (libvlc == NULL) {
libvlc = LoadLibraryW(libreria);
delete buffer;
}
if (libvlc != NULL) {
return EXITO;
delete buffer;
} else {
printf("Libreria libvlc.dll no encontrada, %d\n", GetLastError());
return NO_LIB;
delete buffer;
}
}

/**********************************************************************
* freeLibrary: Libera la librería VLC
**********************************************************************/
bool freeLibrary() {
BOOL libera = false;
if (libvlc != NULL) {
printf("Liberando libreria libvlc.dll\n");
libera = FreeLibrary(libvlc);
if (!libera) {
printf("Error al liberar\n");
}
}
return (libera == VLC_TRUE);
}

/**********************************************************************
* funcionFalla: Muestra un mensaje si una función no puede ser
* obtenida desde la DLL
**********************************************************************/
inline int funcionFalla(const char * msg) {
printf("La funcion %s no pudo inicializarse\n", msg);
freeLibrary();
return FUNCION_FALLA;
}

/**********************************************************************
* initLib: Carga todas las funciones desde la librería
**********************************************************************/
int initLib(LPWSTR libreria) {

if (libvlc == NULL) {
if (loadLibrary(libreria) != EXITO) {
return NO_LIB;
}
}

if ((VLC_AddIntf = (_VLC_ADDINTF) GetProcAddress(libvlc, "VLC_AddIntf")) == NULL)
return funcionFalla("VLC_AddIntf");
if ((VLC_AddTarget = (_VLC_ADDTARGET) GetProcAddress(libvlc, "VLC_AddTarget")) == NULL)
return funcionFalla("VLC_AddTarget");
if ((VLC_CleanUp = (_VLC_CLEANUP) GetProcAddress(libvlc, "VLC_CleanUp")) == NULL)
return funcionFalla("VLC_CleanUp");
if ((VLC_Create = (_VLC_CREATE) GetProcAddress(libvlc, "VLC_Create")) == NULL)
return funcionFalla("VLC_Create");
if ((VLC_Destroy = (_VLC_DESTROY) GetProcAddress(libvlc, "VLC_Destroy")) == NULL)
return funcionFalla("VLC_Destroy");
if ((VLC_Die = (_VLC_DIE) GetProcAddress(libvlc, "VLC_Die")) == NULL)
return funcionFalla("VLC_Die");
if ((VLC_Error = (_VLC_ERROR) GetProcAddress(libvlc, "VLC_Error")) == NULL)
return funcionFalla("VLC_Error");
if ((VLC_FullScreen = (_VLC_FULLSCREEN) GetProcAddress(libvlc, "VLC_FullScreen")) == NULL)
return funcionFalla("VLC_FullScreen");
if ((VLC_Init = (_VLC_INIT) GetProcAddress(libvlc, "VLC_Init")) == NULL)
return funcionFalla("VLC_Init");
if ((VLC_IsPlaying = (_VLC_ISPLAYING) GetProcAddress(libvlc, "VLC_IsPlaying")) == NULL)
return funcionFalla("VLC_IsPlaying");
if ((VLC_LengthGet = (_VLC_LENGTHGET) GetProcAddress(libvlc, "VLC_LengthGet")) == NULL)
return funcionFalla("VLC_LengthGet");
if ((VLC_Pause = (_VLC_PAUSE) GetProcAddress(libvlc, "VLC_Pause")) == NULL)
return funcionFalla("VLC_Pause");
if ((VLC_Play = (_VLC_PLAY) GetProcAddress(libvlc, "VLC_Play")) == NULL)
return funcionFalla("VLC_Play");
if ((VLC_PlaylistClear = (_VLC_PLAYLISTCLEAR) GetProcAddress(libvlc, "VLC_PlaylistClear")) == NULL)
return funcionFalla("VLC_PlaylistClear");
if ((VLC_PlaylistIndex = (_VLC_PLAYLISTINDEX) GetProcAddress(libvlc, "VLC_PlaylistIndex")) == NULL)
return funcionFalla("VLC_PlaylistIndex");
if ((VLC_PlaylistNext = (_VLC_PLAYLISTNEXT) GetProcAddress(libvlc, "VLC_PlaylistNext")) == NULL)
return funcionFalla("VLC_PlaylistNext");
if ((VLC_PlaylistNumberOfItems = (_VLC_PLAYLISTNUMBEROFITEMS) GetProcAddress(libvlc, "VLC_PlaylistNumberOfItems")) == NULL)
return funcionFalla("VLC_PlaylistNumberOfItems");
if ((VLC_PlaylistPrev = (_VLC_PLAYLISTPREV) GetProcAddress(libvlc, "VLC_PlaylistPrev")) == NULL)
return funcionFalla("VLC_PlaylistPrev");
if ((VLC_PositionGet = (_VLC_POSITIONGET) GetProcAddress(libvlc, "VLC_PositionGet")) == NULL)
return funcionFalla("VLC_PositionGet");
if ((VLC_PositionSet = (_VLC_POSITIONSET) GetProcAddress(libvlc, "VLC_PositionSet")) == NULL)
return funcionFalla("VLC_PositionSet");
if ((VLC_SpeedFaster = (_VLC_SPEEDFASTER) GetProcAddress(libvlc, "VLC_SpeedFaster")) == NULL)
return funcionFalla("VLC_SpeedFaster");
if ((VLC_SpeedSlower = (_VLC_SPEEDSLOWER) GetProcAddress(libvlc, "VLC_SpeedSlower")) == NULL)
return funcionFalla("VLC_SpeedSlower");
if ((VLC_Stop = (_VLC_STOP) GetProcAddress(libvlc, "VLC_Stop")) == NULL)
return funcionFalla("VLC_Stop");
if ((VLC_TimeGet = (_VLC_TIMEGET) GetProcAddress(libvlc, "VLC_TimeGet")) == NULL)
return funcionFalla("VLC_TimeGet");
if ((VLC_TimeSet = (_VLC_TIMESET) GetProcAddress(libvlc, "VLC_TimeSet")) == NULL)
return funcionFalla("VLC_TimeSet");
if ((VLC_VariableGet = (_VLC_VARIABLEGET) GetProcAddress(libvlc, "VLC_VariableGet")) == NULL)
return funcionFalla("VLC_VariableGet");
if ((VLC_VariableSet = (_VLC_VARIABLESET) GetProcAddress(libvlc, "VLC_VariableSet")) == NULL)
return funcionFalla("VLC_VariableSet");
if ((VLC_VariableType = (_VLC_VARIABLETYPE) GetProcAddress(libvlc, "VLC_VariableType")) == NULL)
return funcionFalla("VLC_VariableType");
if ((VLC_Version = (_VLC_VERSION) GetProcAddress(libvlc, "VLC_Version")) == NULL)
return funcionFalla("VLC_Version");
if ((VLC_VolumeGet = (_VLC_VOLUMEGET) GetProcAddress(libvlc, "VLC_VolumeGet")) == NULL)
return funcionFalla("VLC_VolumeGet");
if ((VLC_VolumeMute = (_VLC_VOLUMEMUTE) GetProcAddress(libvlc, "VLC_VolumeMute")) == NULL)
return funcionFalla("VLC_VolumeMute");
if ((VLC_VolumeSet = (_VLC_VOLUMESET) GetProcAddress(libvlc, "VLC_VolumeSet")) == NULL)
return funcionFalla("VLC_VolumeSet");
return EXITO;
}

/**********************************************************************
* verError: Muestra un mensaje de error
**********************************************************************/
void getError(int error) {
fprintf(stderr, "Error: %s\n", (VLC_Error)(error));
}


// Main
int main(int argc, char * argv[]) {
if (initLib(L"libvlc.dll") != EXITO) {
printf("No se pudo cargar la libreria\n");
return -1;
}

int id = -1;

// It creates the VLC instance
int i_ret = (VLC_Create)();
if( i_ret < 0 ) {
getError(i_ret);
return i_ret;
}

id = i_ret;

// Inits the instance
printf("%d\n", id);

char ** commands = new char*[6];
commands[0] = "testvlcconsole.exe";
commands[1] = "dshow://";
commands[2] = ":dshow-vdev=Logitech QuickCam Pro 3000 (08B0)";
commands[3] = ":dshow-adev=";
commands[4] = ":dshow-size=176x144";
commands[5] = ":sout=#transcode{vcodec=h264,vb=1024,scale=1}:duplicate{dst=rtp{mux=ts,dst=192.168.0.155,port=1234}}";


i_ret = (VLC_Init)(id, 6, commands );
printf("%d\n", i_ret);
if( i_ret < 0 ) {
getError(i_ret);
(VLC_Destroy)( id );
return -1;
}

// Start playing
i_ret = (VLC_Play)(id);
if( i_ret < 0 ) {
getError(i_ret);
return false;
}

getchar();

while((VLC_IsPlaying)(id));
(VLC_Die)(id);
(VLC_CleanUp)(id);
(VLC_Destroy)(id);
freeLibrary();
return 0;
}
void Cvlc2Dlg::OnBnClickedButton1()
{
loadLibrary((LPWSTR)"c:\\libvlc.dll");

}
static void quit_on_exception (libvlc_exception_t *excp) {
if (libvlc_exception_raised (excp)) {
fprintf(stderr, "error: %s\n", libvlc_exception_get_message(excp));
exit(-1);
}
}
void Cvlc2Dlg::OnBnClickedOk()
{

libvlc_exception_t excp;
libvlc_instance_t *inst;
int item;
char *myarg0 = "-I"; char *myarg1 = "dummy";
char *myarg2 = "--plugin-path=c:\\program files\\videolan\\vlc\\plugins";
char *myargs[4] = {myarg0, myarg1, myarg2, NULL};
char *filename = "c:\\sample.mpeg";
////////////////////////////////////////from here the errors are acciured that same as your reported errors
libvlc_exception_init (&excp);
inst = libvlc_new (3, myargs, &excp);
quit_on_exception (&excp);
item = libvlc_playlist_add (inst, filename, NULL, &excp);
quit_on_exception (&excp);
libvlc_playlist_play (inst, item, 0, NULL, &excp);
quit_on_exception (&excp);
Sleep (10000);
libvlc_destroy (inst);

OnOK();
}

void Cvlc2Dlg::OnBnClickedCancel()
{
OnCancel();
}

silvara
Blank Cone
Blank Cone
Posts: 29
Joined: 03 Jul 2008 10:52

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby silvara » 14 Oct 2008 23:28

hi ;

i have same problem.. I made libvlc.lib out of libvlc.dll.. Include necessary files to VC Additional Include directory, copy all pluggin dll s and libvlc.dll just into my debugger folder.. but i am having below error 1>c:\projects\vlcnew\vlcnew\include\vlc\libvlc.h(76) : error C2065: 'libvlc_exception_t' : undeclared identifier
1>c:\projects\vlcnew\vlcnew\include\vlc\libvlc.h(76) : error C2065: 'p_exception' : undeclared identifier
1>c:\projects\vlcnew\vlcnew\include\vlc\libvlc.h(76) : error C2182: 'libvlc_exception_init' : illegal use of type 'void'
1>c:\projects\vlcnew\vlcnew\include\vlc\libvlc.h(76) : fatal error C1903: unable to recover from previous error(s); stopping compilation
[/code]

I looked inside the includes and find out 'libvlc_exception_t' inside C:\pjproject-1.0-rc2\third_party\vlc\vlc-0.9.4\include\vlc\libvlc_structures.h... but it is already in my include directory.. what might be wrong ?

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby VLC_help » 15 Oct 2008 14:28

And that libvlc_structures.h is also included in c:\projects\vlcnew\vlcnew\include\vlc\libvlc.h ?

joolzg
Blank Cone
Blank Cone
Posts: 22
Joined: 31 Oct 2006 18:12

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby joolzg » 29 Jan 2009 20:58

Can someone post some working code, what i am trying to do is a UDP pvr, i have the udp streams coming from a couple of dvb-t cards and analog cards and i want to be able to schedule a record to take place,

was going to use libVlc but cant seem to get it going becuase of the fact that a .lib does not exist

joolz

maringer
New Cone
New Cone
Posts: 1
Joined: 04 Dec 2007 00:19

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby maringer » 25 Mar 2009 00:33

The problem is, as I understand, more deeper.

You can get the .libs if you rename the files ending with .dll.a in the sdk/lib/ folder (VLC > 0.9). You have to rename it from dll.a to dll.lib.

But this doesn't solve any problem. The real problem is, that in different header files is C code, which doesn't work out of the box with Visual C++ (because of memory management problems).

That is my experience at the moment.

gulcin
New Cone
New Cone
Posts: 4
Joined: 11 May 2009 16:49

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby gulcin » 13 May 2009 13:12

Hello;

I am trying to use libvlc.dll in VS 2008 (C++), and I have the same problem. I have copied the libvlc.dll and plugins to my Debug/ folder in my VC++ console application. Also I have included the directories of vlc-0.9.9a (used: include, src,and libs folders).
I have used the code in the following page: http://wiki.videolan.org/LibVLC_Tutorial
When I try to compile I get the following errors:

//----
Error 10 error LNK2019: unresolved external symbol _libvlc_exception_get_message referenced in function "void __cdecl raise(struct libvlc_exception_t *)" (?raise@@YAXPAUlibvlc_exception_t@@@Z) OB.obj
Error 9 error LNK2019: unresolved external symbol _libvlc_exception_init referenced in function _main OB.obj
Error 11 error LNK2019: unresolved external symbol _libvlc_exception_raised referenced in function "void __cdecl raise(struct libvlc_exception_t *)" (?raise@@YAXPAUlibvlc_exception_t@@@Z) OB.obj
Error 7 error LNK2019: unresolved external symbol _libvlc_media_new referenced in function _main OB.obj
Error 6 error LNK2019: unresolved external symbol _libvlc_media_player_new_from_media referenced in function _main OB.obj
Error 4 error LNK2019: unresolved external symbol _libvlc_media_player_play referenced in function _main OB.obj
Error 2 error LNK2019: unresolved external symbol _libvlc_media_player_release referenced in function _main OB.obj
Error 3 error LNK2019: unresolved external symbol _libvlc_media_player_stop referenced in function _main OB.obj
Error 5 error LNK2019: unresolved external symbol _libvlc_media_release referenced in function _main OB.obj
Error 8 error LNK2019: unresolved external symbol _libvlc_new referenced in function _main OB.obj
Error 1 error LNK2019: unresolved external symbol _libvlc_release referenced in function _main OB.obj
Error 12 fatal error LNK1120: 11 unresolved externals D:\OB\OB_Code\OB\Debug\OB.exe
----//

Is tehere anything that I have forgotten to include? Or, what should I do?

kokila
New Cone
New Cone
Posts: 2
Joined: 04 Oct 2014 03:36

Re: [SOLVED] Using libvlc.dll in VS 2005 (C++)

Postby kokila » 04 Oct 2014 04:02

I am using QT 5.3 version. My compiler is msvc2013opengl.

I have used the following url to create a player using VLC.
https://wiki.videolan.org/LibVLC_Tutorial_086c/


I get the following errors.
main.obj:-1: error: LNK2019: unresolved external symbol _libvlc_new referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol _libvlc_release referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol _libvlc_media_new_path referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol _libvlc_media_player_new_from_media referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol _libvlc_media_player_release referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol _libvlc_media_player_play referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol _libvlc_media_player_stop referenced in function _main
debug\TestVLC.exe:-1: error: LNK1120: 7 unresolved externals

My main.cpp

#include "vplayer.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QTextCodec>
#include <QApplication>
int main(int argc, char *argv[])
{
QCoreApplication::setApplicationName("test");
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QApplication a(argc, argv);
vPlayer w;
w.show();

return a.exec();
}

My .pro file
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = TestVLC
TEMPLATE = app
SOURCES += main.cpp\
vlc_on_qt.cpp
HEADERS += vlc_on_qt.h
FORMS += vlc_on_qt.ui
LIBS += -LC:/Qt/libvlc-qt/lib -llibvlc
LIBS += -LC:/Qt/libvlc-qt/lib -llibvlccore
LIBS += -LC:/Qt/libvlc-qt/lib -lvlc-qt
LIBS += -LC:/Qt/libvlc-qt/lib -lvlc-qt-widgets
INCLUDEPATH += C:/Qt/libvlc-qt/include

I have copied .h files from VLC folder to C:\Qt\libvlc-qt\include
I have copied .dll,.lib,plugins from VLC source code to my application's build folder under debug which is
C:\Qt\Qt5.3.1\Tools\QtCreator\bin\build-TestVLC-Desktop_Qt_5_3_MSVC2013_OpenGL_32bit-Debug\debug

pkgconfig (contains libvlc.pc,vlc-plugin.pc)
plugins (copied from vlc folder)
axvlc.dll
libvlc.dll
libvlc.dll.a
libvlc.a
libvlc.lib
libvlccore.dll
libvlccore.dll.a
libvlccore.la
libvlccore.lib
npvlc.dll
vlc-qt.dll
vlc-qt.lib
vlc-qt-widgets.dll
vlc-qt=widgets.lib

I have added path variables under controlpanel->systemsecurity->advanced system settings->environment variables
C:\Qt\Qt5.3.1\5.3\msvc2013_opengl\bin ( I am not sure whether it is correct)

My projects resides under C:\Qt\Qt5.3.1\Tools\QtCreator\bin. Though I changed the path, the result is the same.

Please help me. What else I have to do


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 77 guests