Page 1 of 1

[HOW] libvlc Helloworld Example C++: VLC

Posted: 10 Mar 2021 00:46
by Cook
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

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

Posted: 10 Mar 2021 08:29
by RĂ©mi Denis-Courmont
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?

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

Posted: 20 Mar 2021 15:06
by trofchik
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.