[HOW] libvlc Helloworld Example C++: VLC

This forum is about all development around libVLC.
Cook
New Cone
New Cone
Posts: 1
Joined: 10 Mar 2021 00:39

[HOW] libvlc Helloworld Example C++: VLC

Postby Cook » 10 Mar 2021 00:46

Hello everyone!
I have a question with regards to using VLC with C++.

I've tried using vlccpp Helloworld project but there seems to be an error in the library.

Since vlc is a header-only file, I've already included the path to the header but I can't upload the screenshot.

I get the following C1083 error message when I try to run the Helloworld example.

May I know how to fix this?

Thank you.

Code: Select all

#include "vlcpp/vlc.hpp" #include <thread> #include <iostream> int main(int ac, char** av) { if (ac < 2) { std::cerr << "usage: " << av[0] << " <file to play>" << std::endl; return 1; } auto instance = VLC::Instance(0, nullptr); auto media = VLC::Media(instance, av[1], VLC::Media::FromPath); auto mp = VLC::MediaPlayer(media); mp.play(); std::this_thread::sleep_for( std::chrono::seconds( 10 ) ); #if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0) <<<-------ERROR SEEMS TO BE HERE mp.stopAsync(); #else mp.stop(); #endif } Build started... 1>------ Build started: Project: vlcHelloWorld, Configuration: Debug Win32 ------ 1>Source.cpp 1>C:\sdk\libvlcpp-master\vlcpp\common.hpp(31,10): fatal error C1083: Cannot open include file: 'vlc/vlc.h': No such file or directory 1>Done building project "vlcHelloWorld.vcxproj" -- FAILED. 1> 1>Project Performance Summary: 1> 237 ms C:\Users\user\source\repos\vlcHelloWorld\vlcHelloWorld\vlcHelloWorld.vcxproj 1 calls

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: [HOW] libvlc Helloworld Example C++: VLC

Postby Rémi Denis-Courmont » 10 Mar 2021 08:29

LibVLC is ostensibly not in the include search path. This is hardly a LibVLC specific issue. Could you maybe do the barest minimum research before posting questions?
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

trofchik
New Cone
New Cone
Posts: 4
Joined: 20 Mar 2021 15:00

Re: [HOW] libvlc Helloworld Example C++: VLC

Postby trofchik » 20 Mar 2021 15:06

You are using libvlcpp which is basically a wrapper around libvlc. For the wrapper to work compiler and linker should also be aware where what it wraps is.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests