I want to include the C++ Libary called URDL. I am developing a program on Xcode with Clang Compiler using Boost 1.56.
As a Sample Project I used this code here and include the Boost Libaries- and Include-Paths in the settings of my Xcode Project.
#include <iostream>
#define URDL_HEADER_ONLY 1
#include <boost/array.hpp>
#include <urdl/http.hpp>
#include <urdl/istream.hpp>
int main(int argc, const char * argv[])
{
urdl::istream is;
return 0;
}
Then I compile I get the following Errors:
in http.ipp from URDL
/Users/maximilian/XcodeProjects/Libaries/urdl-0.1/include/urdl/impl/http.ipp:25:23: Exception specification of overriding function is more lax than base version
and in handler_invole_helpers.hpp from URDL
/usr/local/Cellar/boost/1.56.0/include/boost/asio/detail/handler_invoke_helpers.hpp:37:3: Call to 'asio_handler_invoke' is ambiguous
My suggestion is that URDL is not compatible with this Version of Boost (1.56).
Thanks in Advance
lux_
PS: I must use URDL or at least boost::asio (which URDL is based on, but URDL makes my work much simpler) because it is a homework for an university course.
Problem Solved ! :) Download the URDL Version from Github instead of the Website think-async.com as I did before.
Related
i have installed OpenCV 3.10 and the linked the opencv_world310.lib to release and opencv_world310d.lib to debug.
Moreover I put the compiler options in search directory to ...opencv\build\include. I got a undefined reference error when i left out #include <opencv2/highgui.hpp. Now that i have included it my code looks like this:
#include <stdio.h>
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include <opencv2/highgui.hpp>
int main(void){
printf("HALLO!");
return 0;
}
When i try to build it core.hpp opens and the error: core.hpp must be compiled in C++ occurs.
I am using the GNU GCC Compiler in Codeblocks.
What should i do to solve the problem?
Check you compiler options. Open CV 3.10 C++ API requires code to be compiled as C++, but not C. You can use answer to "CodeBlocks: change project language c and c++" question to change the options.
Also use the new Open CV 3.10 API
#include <opencv2/opencv.hpp>`
instead of all the other Open CV header files. This header includes core functionality. To enable highgui module you need to define HAVE_OPENCV_HIGHGUI in your project settings.
I'm experiencing .Call issues when running functions built with Rcpp on Windows, if my c++ code uses C++11 std::regex and I have found no way out so far.
Unlike prior questions on similar issues, I have had neither building nor linking issues. The Rcpp package builds and links fine using the C++11 plugin, making usable packages on my platform. constexpr and C++11-specific functions like std::stoi cause no issue when std::regex is not used.
Using Windows boost libs, I experienced linking issues, even when specifying PKG_LIBS="-L/path/to/boost/libs -lboost_regex", so I'd rather stick to std::regex.
The same packages build, install and run fine under linux, using vanilla std::regex or boost::regex.
I unfortunately found no solution in the fine Rcpp gallery examples.
Windows platform is :
R version 3.2.3 (2015-12-10)
x86_64-w64-mingw32/x64 (64-bit)
Running under:
Windows >= 8 x64 (build 9200)
Rcpp_0.12.3
Rtools 3.3.0.1959 running g++ 4.9.3 (x86_64-posix-seh,
built by MinGW-W64 project), normally C++11-compatible.
PKG_CXXFLAGS="-std=c++11"
The linux platform is similar except for g++ (version 5.3).
Below is a simplified code chunk for duplication.
#include <Rcpp.h>
#if defined(__linux__) && ! defined(FORCE_STL_BUILD)
#include <boost/regex.hpp>
#define reglib boost
#else
#include <regex>
#define reglib std
#endif
#include <string>
using namespace Rcpp;
// [[Rcpp::plugins(cpp11)]]
constexpr int a[3]= {2, 10, 15};
// [[Rcpp::export]]
int my_test(int prop, const std::string& index)
{
#ifndef NO_REG
static const reglib::regex test {"H.*A", reglib::regex::icase};
#endif
int index_int = std::stoi(index) + a[1] + prop;
return index_int;
}
This code runs OK when built using -DNO_REG. Otherwise invoking test::my_test(1, "1000") returns:
`Error in .Call("test_my_test", PACKAGE = "test", prop, index) :
"test_my_test" not available for .Call() for package "test"`
EDIT:
1. The question focuses on std::regex. Boost issues are only incidental comments.
2. Issues only arise after packaging, not using Rcpp::source("cppfile")
3. Packaging code:
R console:
Rcpp::Rcpp.package.skeleton("test", attributes=TRUE, example_code=FALSE, cpp_files="test.cpp")
Rcpp::compileAttributes("test")
CMD console:
REM paths to R/bin/x64 and Rtools/bin, Rtools/mingw_64/bin added to PATH
set PKG_CXXFLAGS=-std=c++11
R CMD build test
R CMD INSTALL test_1.0.tar.gz
ADDITIONAL EDIT:
.Call issues arise as soon as a regex is declared in the C++ code. Using it or no (as in std::regex_match) makes no change.
Can you try disentangling this some more? You are mixing a lot of things here.
Try maybe 'just' C++ from R first, with the newer g++ 4.9.3 compiler and see if that lets you use Boost as you hope. Your use case there is local and non-standard, so you have to work this out. We generally just recommend using BH without linking.
I don't actually see an Rcpp issue here. You are simply pushing the (working, tested, trusted) Rcpp setup into a corner it has not been used in yet. So you may need to work some things out yourself.
Also note that g++ 4.9.3 for R is not really released yet.
This is a problem I've been having for a solid week now; I am fairly new to C++ programming and am trying to compile the very basics of the socket.io C++ library in xcode 6.
This is the code I am using.
#include <iostream>
#include <string>
#include "sio_client.h"
int main(int argc, const char * argv[]) {
sio::client h;
h.connect("http://127.0.0.1:3000");
}
The build settings under target are:
Library search path: /usr/local/Cellar/boost/1.58.0/lib
User Header search path: /usr/local/Cellar/boost/1.58.0/include, "$(SRCROOT)/boost/socket.io-client-cpp/lib/websocketpp"and "$(SRCROOT)/boost/socket.io-client-cpp/lib/rapidjson/include"
I have installed Boost using brew install boost --c++11 and imported the libc++.dylib and tried the libc++.6.0.9.dylib as frameworks into the project.
And I am getting the following compiling error.
Note: following tutorial from - https://github.com/socketio/socket.io-client-cpp.
Can anybody PLEASE! Help me, I am dying here :P
i want to use MongoDB from my C++ application, I've downloaded the MongoDb binary Version 3.0.5 and the legacy C++ Driver Version 1.0.5 from Git and installed both.
I followed the instruction with this code:
#include <cstdio>
#include <mongo/bson/bson.h>
#include <mongo/client/dbclient.h>
int main(int argc, char *argv[])
{
mongo::Status status = mongo::client::initialize();
return 0;
}
After Compile and Run i get to following message:
Attempt to add global initialiser failed, status: DuplicateKey GlobalLogManager Abort
Some ideas ?
I can reproduce the same behavior when using legacy driver compiled for C++03 (default) and application code compiled with C++11/C++14. It always segfaults and sometimes writes the same message (depending optimization level). See the related bug on mongo website.
The solution is to either:
compile your code with C++03 (-std=c++03)
recompile the driver with C++11 support.
For the C++11 support in driver, simply pass --c++11=on to scons.
scons --c++11=on install
Tested with GCC 4.9.1
I understand this has been asked million times but still I just couldn't found the solution.
I am using OSX 10.8, boost 1.50, xcode 4.5.1.
I installed boost using macports.
created an empty xcode project. My main.cpp contains the following code
#include "boost/container/deque.hpp"
int main(int argc, char *argv[])
{
boost::container::deque d(12, 5.5f);
return 0;
}
updated 'header search path' to point to '/opt/local/include'
updated 'library search path' to point to '/opt/local/lib'
tried changing 'c++ language dialect', 'c++ standard library' and other settings with no success at all.
when I build the project, I get error related to semantic issue in allocator_traits.hpp and deque.hpp and I have no idea why. I am afraid as I start using more boost libraries more errors will pop up.
deque.hpp (line 482 and 483)
base specifier must be a class name (ptr_alloc_t and allocator_type)
what else do I need to do to configure boost. why using boost is so complicated?
boost::container::deque is a template class and you must specify which type do you use. In your case this is float:
boost::container::deque<float> d(12, 5.5f);
You can read more about templates here