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.
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
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
I have read a ton of this same question, but I appear to be doing everything correctly as all suggestions advise, but am still getting this error.
I have simple .cpp and .h files in C++ using Visual Studio 2015. My program runs perfect from the gui. I need to run it in the visual studio developer command window to get the results there, this is a verified console application. I have copied the files to their own directory using:
C:\RunDirectory>copy C:\SaveDirectory\
The system verifies that it copies all 15 files.
When I run this command:
C:\RunDirectory>cl Aprogram.cpp
Then I get the error.
I have a main that is returning an int, and this is a console application with the correct linker settings: Console (/SUBSYSTEM:CONSOLE)
Any ideas? I'm pretty stumped.
This is my driver file:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include "JollyBanker.h"
using namespace std;
int main()
{
JollyBanker theBanker;
theBanker.BuildQueue("BankTransIn.txt");
theBanker.ProcessQueue();
theBanker.DisplayResults();
return 0;
}
File Aprogram.cpp is a source code file, which is compiled and linked
into an executable by Visual Studio IDE. Assuming that default project
settings are used, this executable is located in "Debug" or "Release"
subdirectory of the directory that contains your solution and it is named
ProjectName.exe (where "ProjectName" is the name of the project
within the solution that contains Aprogram.cpp)
Also, you mentioned that you want to make sure it works outside VS. Note
that if you have used the default settings, you will have problems when you
run this executable on another machine. To solve this, I suggest that you
change the runtime library that you are linking to. To do this, right click on
the project in Solution Explorer and select "Properties". Go to "C/C++" -> "Code Generation"
and change the value of "Runtime Library" to "Multi-threaded Debug (/MTd)" for "Debug" configuration, or to "Multi-threaded (/MT)" for "Release" configuration.
This is a really basic question because I am a C++ newbie. I want to use the Boost.Interprocess library, but am having trouble building it. I'm trying to follow these instructions, but it's not working for me. Here is what I have:
#define BOOST_DATE_TIME_NO_LIB
#include <boost/interprocess/shared_memory_object.hpp>
#include <iostream>
using namespace std;
int main() {
cout << "Hello, beautiful world!\n";
}
But I get this error:
boost_1_55_0\boost\date_time\gregorian_calendar.hpp(63) : fatal error C1083: Cannot open include file: 'boost/date_time/gregorian_calendar.ipp': No such file or directory
I know Boost is able to load properly, because I can get an example that uses #include <boost/lambda/lambda.hpp> to work just fine. It's just when I try to include the Boost.Interprocess library that I am having trouble. The cause is clearly because it's having trouble including the Boost.DateTime library properly, but according to the documentation (linked above) I should be able to get by without separately compiling Boost.DateTime if I define BOOST_DATE_TIME_NO_LIB, right?
What am I missing here?
You need to add it to the preprocessor
In VS go to - Project >> properties >> C/C++ >> Preprocessor in the 'Preprocessor Definitions' paste BOOST_DATE_TIME_NO_LIB.
You can download boost libraries here: https://www.boost.org/users/download/
After that, you can include them in your projects. Also, you can check this video on how to add boost libraries in eclipse IDE on Ubuntu: https://www.youtube.com/watch?v=gN8zrnWxFeI
I am trying to build a C++ app that uses both websocketpp and MySQL. I have encountered 2 build problems using VS 2010 C++ Express.
1) A problem with the boost libraries. It produces many errors like this:
1>c:\program files (x86)\boost\boost_1_50\boost\thread\win32\thread_data.hpp(210): error C2146: syntax error : missing ')' before identifier 'rel_time'
Here's the relevant snippet from thread_data.hpp starting with line 210:
inline BOOST_SYMBOL_VISIBLE void sleep(TimeDuration const& rel_time)
{
interruptible_wait(detail::pin_to_zero(rel_time.total_milliseconds()));
}
2) A conflict with the word VERSION which is documented here and I believe is independent.
To make a clear and simple example of the boost build problems, I'm using the websocketpp example: echo_server.cpp to which I added these includes:
#include "stdafx.h"
Boost lib includes recommended by "Building a program with websocketpp" on the websocketpp site.
#include <boost/regex.hpp>
#include <boost/random.hpp>
#include <boost/system/api_config.hpp>
#include <boost/system/config.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/system/windows_error.hpp>
and the MySQL header includes. Adding these 2 boostincludes triggers the build errors. If I comment out these 2 includes, it builds without errors:
#include <my_global.h>
#include <mysql.h>
Any suggestions on how to deal with the boost problems?
I don't think this is the same build problem as this one, "Trying to build websocket++ with MinGW: last few linker errors — what could it be?"
Concerning the first error, check if there are any macros interfering with the code. Right-click and go to definition or #define the macro yourself at the beginning of the file and see where it gets redefined. In really hard cases, look at the preprocessor output via a compiler flag.
Concerning the rest, you don't provide any versions for Boost and MySQL. Then, there is my_global.h (or is that part of MySQL?) and stdafx.h, which are both under your control but you don't show them here. Also, try to reduce the issue to the smallest possible piece of code. In short, provide a reproducible example.