So my goal is to build a native WebRTC application using the WebRTC C++ api.
I compiled webrtc for use with Visual Studio (2015) using the following guide:
https://github.com/ipop-project/ipop-project.github.io/wiki/Building-the-WebRTC-lib-for-Windows
After the build completed I tried creating a new Visual Studio console project and added the following code:
#include <iostream>
#define WEBRTC_WIN
#include <webrtc/api/peerconnection.h>
#include <webrtc/api/peerconnectionfactory.h>
#include <webrtc/api/peerconnectioninterface.h>
int main()
{
auto pcf = webrtc::CreatePeerConnectionFactory();
std::cout << "Hallo!" << std::endl;
}
Adding the build directory to the include search path works fine, however I'm unable to link the application, searching the build directories for lib-files and adding them to the linker only adds more link error as there is a whole bunch and I suspect some of them should not be linked to my application.
What is the correct way to link the application, and how do I know what .lib-files the functionality I use resides in?
I solved it!
After digging around in the build files for the examples in WebRTC I found that the following libraries should be linked:
obj\webrtc\api\libjingle_peerconnection.lib
obj\webrtc\system_wrappers\field_trial_default.lib
obj\webrtc\system_wrappers\metrics_default.lib
obj\third_party\jsoncpp\jsoncpp.lib
obj\webrtc\media\rtc_media.lib
obj\webrtc\base\rtc_base_approved.lib
obj\webrtc\webrtc_common.lib
obj\webrtc\webrtc.lib
obj\webrtc\system_wrappers\system_wrappers.lib
obj\webrtc\voice_engine\voice_engine.lib
obj\webrtc\common_audio\common_audio.lib
obj\third_party\openmax_dl\dl\openmax_dl.lib
obj\webrtc\common_audio\common_audio_sse2.lib
obj\webrtc\modules\audio_coding_module.lib
obj\webrtc\modules\cng.lib
obj\webrtc\modules\audio_encoder_interface.lib
obj\webrtc\modules\g711.lib
obj\webrtc\modules\pcm16b.lib
obj\webrtc\modules\ilbc.lib
obj\webrtc\modules\webrtc_opus.lib
obj\third_party\opus\opus.lib
obj\webrtc\modules\g722.lib
obj\webrtc\modules\isac.lib
obj\webrtc\modules\audio_decoder_interface.lib
obj\webrtc\modules\isac_common.lib
obj\webrtc\modules\red.lib
obj\webrtc\rtc_event_log.lib
obj\webrtc\rtc_event_log_proto.lib
protobuf_lite.dll.lib
obj\webrtc\modules\neteq.lib
obj\webrtc\modules\builtin_audio_decoder_factory.lib
obj\webrtc\modules\audio_decoder_factory_interface.lib
obj\webrtc\modules\rent_a_codec.lib
obj\webrtc\modules\audio_conference_mixer.lib
obj\webrtc\modules\audio_processing.lib
obj\webrtc\modules\audioproc_debug_proto.lib
obj\webrtc\modules\audio_processing_sse2.lib
obj\webrtc\modules\webrtc_utility.lib
obj\webrtc\modules\media_file.lib
obj\webrtc\base\rtc_task_queue.lib
obj\webrtc\modules\audio_device.lib
obj\webrtc\modules\bitrate_controller.lib
obj\webrtc\modules\paced_sender.lib
obj\webrtc\modules\rtp_rtcp.lib
obj\webrtc\common_video\common_video.lib
libyuv.lib
obj\third_party\libjpeg_turbo\libjpeg.lib
obj\webrtc\modules\remote_bitrate_estimator.lib
obj\webrtc\voice_engine\level_indicator.lib
obj\webrtc\modules\congestion_controller.lib
obj\webrtc\modules\video_capture_module.lib
obj\webrtc\modules\video_processing.lib
obj\webrtc\modules\video_processing_sse2.lib
obj\webrtc\modules\webrtc_video_coding.lib
obj\webrtc\modules\webrtc_h264.lib
obj\webrtc\modules\webrtc_i420.lib
obj\webrtc\modules\video_coding\utility\video_coding_utility.lib
obj\webrtc\modules\video_coding\codecs\vp8\webrtc_vp8.lib
obj\third_party\libvpx\libvpx.lib
obj\third_party\libvpx\libvpx_intrinsics_mmx.lib
obj\third_party\libvpx\libvpx_intrinsics_sse2.lib
obj\third_party\libvpx\libvpx_intrinsics_ssse3.lib
obj\third_party\libvpx\libvpx_intrinsics_sse4_1.lib
obj\third_party\libvpx\libvpx_intrinsics_avx.lib
obj\third_party\libvpx\libvpx_intrinsics_avx2.lib
obj\webrtc\modules\video_coding\codecs\vp9\webrtc_vp9.lib
obj\webrtc\p2p\rtc_p2p.lib
obj\webrtc\base\rtc_base.lib
boringssl.dll.lib
obj\third_party\usrsctp\usrsctplib.lib
obj\webrtc\modules\video_capture_module_internal_impl.lib
obj\third_party\winsdk_samples\directshow_baseclasses.lib
obj\webrtc\pc\rtc_pc.lib
obj\third_party\libsrtp\libsrtp.lib
winmm.lib
dmoguids.lib
wmcodecdspuuid.lib
amstrmid.lib
msdmo.lib
crypt32.lib
iphlpapi.lib
secur32.lib
Strmiids.lib
The document you linked to, says you need the following libraries:
boringssl.dll.lib
boringssl_asm.lib
field_trial_default.lib
jsoncpp.lib
rtc_base.lib
rtc_base_approved.lib
rtc_p2p.lib
rtc_xmllite.lib
rtc_xmpp.lib
I would link against all of them. It's unlikely to hurt.
There is a precompiled (binary) package available for Windows: here.
It contains a single lib to link, libwebrtc_full.lib
Related
Can someone please help me with my issue with Aspose.Cells library for C++?
I was writing my first C++ programme using Aspose.Cells library. Everything seemed smooth except that the following error was produced after I built the file:
Error before I launch is:
"Error exist in a required project.Continue launch?"
Error after running the code is:
"**fatal error: boost/config/compiler/gcc.hpp: No such file or directory**".**
If I commented out the line #<include Aspose.Cells.h>, the file can run with no errors.
I tried to solve the error by installing Boost library for C++ from zip file "boost_1_73_0", as I think Aspose depends on Boost to run. However, I couldn't link to Boost successfully as there doesn't seem to be a "include" folder and "lib" folder for me to add into project properties.
My questions are:
Will installing Boost solve my problem?
If yes, how can I install Boost library successful?
The following is my code in C++. Thanks a Lot in advance!
#include <iostream>
#include <Aspose.Cells.h>
using namespace std;
int main() {
cout << "!!!I am little red!!!" << endl;
return 0;
}
Regards
Hillary
UPDATE: I have successfully installed and linked Boot library now but I have got three warning message upon building: "Ignoring #pragma warning [-wunknown-pragmas]" , are these warning messages serious?
I also ran into another fatal error: unicode/uloc.h:No such file or directory. How can I correctly link up to unilib-master/Unicode library?
Yes, installing Boost helps.
If Aspose only requires header-only libraries from Boost, then you don't have to do much. The "include" path you're looking for is just the folder where you extracted the zip. The actual library headers are under boost/ in that folder, which are then found by the compiler.
If you need the shared libraries, you will need to build them. Follow the steps here Getting Started On Windows
i m trying to use sfml in my project using visual studio 2019. Following sfml documentation to perform setup for visual studio i have performed all the action required
i have included include folder in c/c++/additional include directory and also provided path for lib folder in linker setting and also provided additional dependencies in linker/input
but
#include <iostream>
#include <SFML/Graphics.hpp>
int main()
{
std::cout << "i cant tolerate" << std::endl;
return 0;
}
this code shows above mentioned error ,
cannot open include file 'Graphics.hpp' no such file or directory
it seems like include path is not working
how can i solve this issue
i tried many times but got same result
if anyone facing the same problem please check the platform in the project/properties win32 worked for my particular problem
The problem
I'm trying to build a project in Visual Studio 2015 on Win10 that makes use of libssh, but I'm having no luck getting it to work. I feel like I'm losing my mind here. I'm either completely blanking out or missing something incredibly obvious.
I've tried using the installer libssh-0.7.2-msvc.exe from the files section at https://red.libssh.org/projects/libssh/files. I then linked it to a test C++ project in VS2015. Using the sample code I'm able to compile it:
#include <iostream>
#define LIBSSH_STATIC
#include <libssh/libssh.h>
int main() {
std::cout << "Starting libssh test" << std::endl;
ssh_session my_ssh_session = ssh_new();
if (my_ssh_session == NULL) {
std::cout << "Failed to initialize" << std::endl;
}
ssh_free(my_ssh_session);
return 0;
}
(Note: I've tried both #define LIBSSH_STATIC and #define LIBSSH_STATIC 1 based on posts I've seen from my initial search for answers. I've even tried adding it to the preprocessor definitions in project properties.)
I can only compile it if my project is set to 32-bit, but I can't run the resulting executable. Doing so results in an error: "The code execution cannot proceed because ssh.dll was not found. Reinstalling the program may fix this problem." I'm statically linking ssh.lib, though, so I'm not sure why I'm even getting that error.
So I tried compiling libssh myself as 64-bit. It took some more tinkering than I expected (I had some issues with zlib, which eventually I just omitted since it's optional). I can compile my project as a 64-bit executable successfully, but once again, I can't actually run it. I get the same error about ssh.dll being missing.
For the sake of trying it, I removed the LIBSSH_STATIC define and tried to link just to the DLL. Copying the ssh.dll from the libssh distribution into my program folder and trying to run it, I get the error: "The application was unable to start correctly (0xc000007b). Click OK to close the application."
I'm not sure what I'm missing here, but I'm sure it's dumb and I'm overthinking it.
Project settings (all configurations, all platforms)
libssh is installed to G:\Libraries\libssh_0.7.2 on my machine.
Configuration Properties > VC++ Directories > Include Directories
G:\Libraries\libssh_0.7.2\include;$(IncludePath)
Configuration Properties > VC++ Directories > Library Directories
G:\Libraries\libssh_0.7.2\lib;$(LibraryPath)
Configuration Properties > Linker > Input > Additional Dependencies
ssh.lib;%(AdditionalDependencies)
libssh path summary
libssh_0.7.2
bin
ssh.dll
include
libssh
callbacks.h
legacy.h
libssh.h
libsshpp.hpp
server.h
sftp.h
ssh2.h
lib
ssh.lib
Install vkpkg
⊞ Win+X and open the powershell
Input vckpg install libssh:x64-windows
Integrate into Visual Studio: vcpkg integrate install
Then you can include <libssh.h> in Visual Studio.
This is not a new question but the solutions haven't worked for me. I want to read dicom files using C++. I have 32-bit Windows PC with VS 2013 community edition.
This post and other answers therein suggested using DCMTK. I installed DCMTK (using CMake followed by VS) and configured it for use with VS using guidelines and links provided in this post. Then I wrote a simple test program and tried to compile it:
#include "stdafx.h"
#include "dcmtk\dcmdata\dctk.h"
#include "dcmtk\config\osconfig.h"
#include "dcmtk\dcmimgle\dcmimage.h"
#include <iostream>
using namespace std;
int main()
{
DicomImage *image = new DicomImage("test.dcm");
if (image != NULL)
{
if (image->getStatus() == EIS_Normal)
{
if (image->isMonochrome())
{
image->setMinMaxWindow();
Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits */));
if (pixelData != NULL)
{
/* do something useful with the pixel data */
}
}
}
else
cerr << "Error: cannot load DICOM image (" << DicomImage::getString(image->getStatus()) << ")" << endl;
}
delete image;
return 0;
}
Upon compilation, it gives the following error:
dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _Netbios#4 referenced in function "unsigned char * __cdecl getMACAddress(unsigned char * const)" (?getMACAddress##YAPAEQAE#Z)
This error seems to be common but none of the following solutions work for me:
FAQ#27 and another post of DCMTK forum: It suggests using particular order of lib files to be included. My order of including files is as follows (I tried the reverse order as well but it didn't work):
All of this doesn't work. In fact, I'm not sure which lib files are supposed to be included? How to decide that?
I've also included "C:\Program Files\DCMTK\lib" under additional library directories and "C:\Program Files\DCMTK\include" under additional include directories in project properties.
Another similar question at stackoverflow has not been answered. Comments suggest to re-run CMake by disabling DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS. I didn't do it because the DCMTK help page says don't disable this unless you really know what you're doing.
Can someone please guide?
The NetBios function resides in NETAPI32.LIB, so you can try moving NetAPI32.lib (which is in your list) to the top of that list.
Not sure which version of the DCMTK you use, but for the current development snapshot you need the following standard libraries (on Windows): "ws2_32 netapi32 wsock32". This information can be found in DCMTK's CMake files. By the way, you don't seem to use CMake for your project, right?
I think you misspelled dcmsign.lib as dcmsig.lib.
If changing that doesn't fix it, I would suggest the following order based on the support page that you linked to:
NetAPI32.lib
WSock32.lib
ofstd.lib
oflog.lib
dcmdata.lib
dcmsign.lib
dcmnet.lib
dcmsr.lib
dcmqrdb.lib
dcmtls.lib
dcmwlm.lib
dcmimgle.lib
dcmpstat.lib
dcmjpls.lib
dcmjpeg.lib
dcmimage.lib
ijg16.lib
ijg12.lib
ijg8.lib
I think that in this list, each library has to come after all the libraries that it depends on.
check your .lib and vs platform if the same ,such lib for x64, then your vs platform must be x64.
I had the same error. You can go to project properties-> linker -> input -> Additional Dependencies-> Edit -> add these two libraries-( netapi32.lib,wsock32.lib) before all other libraries . This solved the error for me .
I have written the following code
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <boost/system/windows_error.hpp>
using namespace boost::system;
int main(){
boost::asio::io_service io;
boost::asio::deadline_timer t(io,boost::posix_time::seconds(5));
t.wait();
std::cout<<"hello world";
return 0;
}
and I get the following error:
1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc100-mt-gd-1_44.lib'
I dont know how and what do, can you please explain what is happening and what steps I can take to fix it?
Ok, for MSVC++ 2010
Under Project Properties, goto
Configuration Properties -> Linker -> General -> Additional Library Directories and add there the path to the *.lib file (For example: C:\boost_1_41_0\stage\lib)
As far as I can tell from the error message it compiles but can't find the boost compiled libraries.
These you have to build yourselves unless you can find them prebuilt.
IIRC boost are built using a tool called bjam. I think this explains it rather throughly: http://www.highscore.de/cpp/boostbuild/index.html.
After it's built you have to instruct the compiler to link it using the project properties.
I suspect you haven't built the libraries. You can get the pre-built libraries from BoostPro or you can build them yourself following the instructions at http://www.boost.org/doc/libs/1_44_0/more/getting_started/windows.html
I was working in one instance of Visual Studio 2010. When I started up another, to scrawl out a bit of code, I was shocked to see the same error message. Reset includes and lib (Project->NameofProject Properties then select VC++ Directories) and toggled back and forth between debug and release, at first just once, then a few more times, as I grew increasingly alarmed at none of this working.
Even though the IDE didn't report any activity ('Build Failed,' was all it said in the place where it shows includes/libs being enumerated) after a few minutes (of furious web browsing) I came back to discover that it had silently self-fixed.