ml-cpp | Machine learning C++ code
kandi X-RAY | ml-cpp Summary
Support
Quality
Security
License
Reuse
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
ml-cpp Key Features
ml-cpp Examples and Code Snippets
Trending Discussions on ml-cpp
Trending Discussions on ml-cpp
QUESTION
I am following this tutorial, in order to have a gRPC service transcoded to HTTP. However, it is not up to date, since it uses envoy API v2, but this is not anymore available (I am getting an error saying this), they are now using the v3. Therefore, the syntax is slightly different.
For the v2, this snippet has no syntax error, however, it raises an error saying that the V2 is not available anymore (so it is not usable in the end):
- name: envoy.http_connection_manager
config:
...
According to this example, the way of having an HTTP connection manager (which is v3 compliant) would be to do like this, in an envoy.yml
configuration file (we are explicitly telling that we are using the v3):
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
However, I am getting an Illegal map value
error pointing on the "@type"
: error initializing configuration '/etc/envoy/envoy.yaml': yaml-cpp: error at line 15, column 17: illegal map value
I also have tried to force envoy to use the V2, with the flag --bootstrap-version 2
, but it keeps saying that the v2 is no longer in use, so the only way of using envoy now is to use the v3. Do you have experienced the same issue ? My goal is just to have an rGPC service transcoded to HTTP.
If you need more materials to figure out the problem, I uploaded the whole project on GitHub
ANSWER
Answered 2021-May-25 at 08:03Yes, its a bit of a pain. There's an online envoy config checker that helps a bit in determining exactly which versions ditch backwards compatability.
You have correctly switched from the legacy config
to typed_config
data.
However, it looks like you inadvertently included a tab in your latest config (line 15) which causes illegal map value
.
You also need to migrate clusters/hosts
section to load_assignments
like this:
load_assignment:
cluster_name: grpc-backend-services
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 53000
There's a good example in the current envoy docs: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/grpc_json_transcoder_filter
QUESTION
I'm using yaml-cpp
from conan center, in my conan file, yaml-cpp/0.6.3
, along with other dependencies.
The rest of the libraries link properly, so there must be something missing in my CMakeLists.txt
file. (Maybe some extra definition...?)
Until now, with those lines:
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
set(CMAKE_CXX_STANDARD 20)
It worked fine (For other libraries, like bullet, glm...)
At link time, problems with missing implementation arise:
cmake --build build --config Debug --target all -- -j 10
/usr/bin/ld: CMakeFiles/my-project.dir/src/MySourceFile.cpp.o: in function `YAML::Node::Scalar[abi:cxx11]() const':
/home/my-user/.conan/data/yaml-cpp/0.6.3/_/_/package/82ef5eac51c38971dea2fd342dd55ddf2ddfbbc3/include/yaml-cpp/node/impl.h:169: undefined reference to `YAML::detail::node_data::empty_scalar[abi:cxx11]()'
/usr/bin/ld: CMakeFiles/my-project.dir/src/MySource.cpp.o: in function `tojson::loadyaml(std::__cxx11::basic_string, std::allocator > const&)':
/home/my-user/my-project/lib/nlohmann/tojson.hpp:162: undefined reference to `YAML::LoadFile(std::__cxx11::basic_string, std::allocator > const&)'
collect2: error: ld returned 1 exit status
Seems that the problem is that YAML::LoadFile
appears to be undefined.
(I've tried using it without tojson
also)
YAML::Node test = YAML::LoadFile("test.yaml");
ANSWER
Answered 2021-May-17 at 18:59The package is okay, but your profile is misconfigured.
undefined reference to `YAML::LoadFile(std::__cxx11::basic_string const&)' collect2: error: ld returned 1 exit status
You have to update your libcxx setting:
conan profile update settings.compiler.libcxx=libstdc++11 default
More info about: https://docs.conan.io/en/latest/howtos/manage_gcc_abi.html
QUESTION
I'm using Arch Linux and working on a project using wxgtk3
which I installed from pacman
, I also installed wxformbuilder
from the AUR
which pulls in wxgtk2
as a dependency. When I try to build my program, it builds fine, but when I try to run it, it throws a huge error message,
.
.
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxTreebook" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxVListBox" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxVScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxHScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxHVScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxXmlResourceHandler" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
(SampleHive:26191): Gtk-ERROR **: 05:45:13.924: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
zsh: trace trap ./SampleHive
this is only a small section of the error..
But if I uninstall wxgtk2
and try to run my program again, it runs fine. Is there a way to specify in meson
to always use wxgtk3
, so I don't have to uninstall wxgtk2
again and again, as I need wxformbuilder
installed on my system.
EDIT:
This is my meson.build
file,
project('SampleHive', 'cpp',
version : '0.1',
license : 'GPL v3',
default_options : ['warning_level=1',
'cpp_std=c++11'])
src = [
'src/App.cpp',
'src/MainFrame.cpp',
'src/Browser.cpp',
'src/SettingsDialog.cpp',
'src/TagEditorDialog.cpp',
'src/Database.cpp',
'src/Serialize.cpp',
'src/TreeItemDialog.cpp',
'src/Tags.cpp',
]
wx = dependency('wxwidgets', modules : ['media', 'std'])
wxsvg = dependency('libwxsvg')
taglib = dependency('taglib')
sqlite3 = dependency('sqlite3')
yaml = dependency('yaml-cpp')
wx_inc = include_directories('/usr/include/wx-3.0')
executable('SampleHive',
sources : src,
dependencies : [wx, wxsvg, taglib, sqlite3, yaml],
include_directories : wx_inc)
to build the project I run,
meson build
ninja -C build
And here is the link to the repository - SampleHive
ANSWER
Answered 2021-Mar-20 at 22:45You can specify version for your dependency as:
some_dep = dependency('some_dep', version : '>=1.2.3')
In your case, use :
wx = dependency('wxwidgets', modules : ['media', 'std'], version: '>=3.0.0')
QUESTION
I follow the steps in the webpage, a problem came out when executing./setup/mac/install_prereqs.sh
drake % ./setup/mac/install_prereqs.sh
+ binary_distribution_args=()
+ source_distribution_args=()
+ '[' '' '!=' '' ']'
+ source ./setup/mac/binary_distribution/install_prereqs.sh ''
++ set -euxo pipefail
++ with_update=1
++ '[' '' '!=' '' ']'
++ [[ 501 -eq 0 ]]
++ command -v conda
++ command -v brew
++ [[ -z '' ]]
++ export HOMEBREW_NO_AUTO_UPDATE=1
++ HOMEBREW_NO_AUTO_UPDATE=1
++ export HOMEBREW_NO_INSTALL_CLEANUP=1
++ HOMEBREW_NO_INSTALL_CLEANUP=1
++ binary_distribution_called_update=0
++ [[ 1 -eq 1 ]]
++ brew update
Already up-to-date.
++ binary_distribution_called_update=1
++ brew tap robotlocomotion/director
+++ cat
++ brew uninstall --force robotlocomotion/director/scipy@1.5.4 robotlocomotion/director/numpy@1.19.4
++ brew bundle --file=./setup/mac/binary_distribution/Brewfile --no-lock
Using dreal-deps/ibex
Using robotlocomotion/director
Using adoptopenjdk
Using clp
Using cmake
Using double-conversion
==> Installing ibex@2.7.4 from dreal-deps/ibex
==> Downloading https://github.com/dreal-deps/ibex-lib/archive/ibex-2.7.4_10.tar.gz
Already downloaded: /Users/marui/Library/Caches/Homebrew/downloads/cf1b94f6783b4d23cc0bd34c10833f34cea5e7cff82ddfa24d7613f439a9d7f2--ibex-lib-ibex-2.7.4_10.tar.gz
==> ./waf configure --prefix=/opt/homebrew/Cellar/ibex@2.7.4/2.7.4_10 --enable-shared --with-optim --with-solver --with-affine-extended --interval-lib=filib --lp-lib=clp --clp-path=/opt/homebrew/opt/clp
Last 15 lines from /Users/marui/Library/Logs/Homebrew/ibex@2.7.4/01.waf:
Checking for program 'make' : /opt/homebrew/Library/Homebrew/shims/mac/super/make
Applying patch : filibsrc-3.0.2.2.all.all.patch
Calling configure : done
Calling make : done
Calling install : done
Checking for header interval/interval.hpp : yes
Checking for library prim : yes
Checking for compiler flags -frounding-math : yes
Checking for compiler flags -ffloat-store : yes
Checking for header interval/interval.hpp with -msse3 : yes
Configuration of the library for LP
Library for LP : clp
Checking for 'clp' : not found
The configuration failed
(complete log in /private/tmp/ibex-2.7.4-20210319-75719-hq0bkg/ibex-lib-ibex-2.7.4_10/__build__/config.log)
Do not report this issue to Homebrew/brew or Homebrew/core!
Installing dreal-deps/ibex/ibex@2.7.4 has failed!
Using eigen
Using gcc
Using fmt
Using gflags
Using glew
Using glib
Using graphviz
Using ipopt
Using libyaml
Using lz4
Using nlopt
Using numpy
Using openblas
Using pkg-config
Using python@3.9
Using scipy
Using spdlog
Using suite-sparse
Using tinyxml
Using tinyxml2
Using robotlocomotion/director/vtk@8.2.0
Using xz
Using yaml-cpp
Using zeromq
Homebrew Bundle failed! 1 Brewfile dependency failed to install.
How can i fix this? Thanks in advance.
ANSWER
Answered 2021-Mar-19 at 05:03The official answer: "On macOS, x86_64 is the only supported architecture and running Drake under Rosetta 2 emulation on arm64 is not supported." -- https://drake.mit.edu/developers.html#supported-configurations as of 2021-03-18.
You can subscribe to https://github.com/RobotLocomotion/drake/issues/14555 for any updates regarding M1 support.
However, if you want to try to hack through it locally, you could try commenting out homebrew dependencies that do not succeed (e.g., IBEX in this case).
With IBEX disabled, you'll also have to bazel build --define=NO_DREAL=ON
to disable dReal for the moment. Likely, other dependencies will also fail, but we have not tested on M1 yet so we don't know how close it is to working.
I've filed https://github.com/dreal/homebrew-dreal/issues/10 in case we can fix the IBEX problem easily.
The other option would be to spin up an Ubuntu VM (based on either 18.04 or 20.04).
QUESTION
I'm trying to make configuration file for my application, for which I'm using yaml-cpp
library to generate a configuration and modify when user changes changes some setting or something in the application. I have a separate class set up for this, the constructor generates the yaml
file which looks like this,
Serializer::Serializer(const std::string& filepath)
{
std::ifstream ifin(filepath);
if (!ifin)
{
emitter << YAML::Comment("Hello");
emitter << YAML::BeginDoc;
emitter << "This is the configuration file for the Sample Browser,"
<< YAML::Newline;
emitter << "feel free to edit this file as needed";
emitter << YAML::EndDoc;
emitter << YAML::BeginMap;
emitter << YAML::Newline << YAML::Key << "Window";
emitter << YAML::BeginMap;
emitter << YAML::Key << "SizeW" << YAML::Value << "1280";
emitter << YAML::Key << "SizeH" << YAML::Value << "720";
emitter << YAML::EndMap << YAML::Newline;
emitter << YAML::Newline << YAML::Key << "Media";
emitter << YAML::BeginMap;
emitter << YAML::Key << "Autoplay" << YAML::Value << "false";
emitter << YAML::Key << "Loop" << YAML::Value << "false";
emitter << YAML::Key << "Muted" << YAML::Value << "false";
emitter << YAML::EndMap << YAML::Newline;
emitter << YAML::Newline << YAML::Key << "Display";
emitter << YAML::BeginMap;
emitter << YAML::Key << "Font";
emitter << YAML::BeginMap;
emitter << YAML::Key << "Family" << YAML::Value << "Sans";
emitter << YAML::Key << "Size" << YAML::Value << "10";
emitter << YAML::EndMap;
emitter << YAML::EndMap << YAML::Newline;
emitter << YAML::Newline << YAML::Key << "Import_dir";
emitter << YAML::BeginMap;
emitter << YAML::Key << "AutoImport" << YAML::Value << "false";
emitter << YAML::Key << "Directory" << YAML::Value << "/home/apoorv";
emitter << YAML::EndMap << YAML::Newline;
emitter << YAML::EndMap;
std::ofstream ofout(filepath);
ofout << emitter.c_str();
}
else
{
wxLogDebug("Config file already exists! Skipping..");
}
}
and the output of this file looks like,
# Hello
---
This is the configuration file for the Sample Browser,
feel free to edit this file as needed
...
Window:
SizeW: 1280
SizeH: 720
Media:
Autoplay: false
Loop: false
Muted: false
Display:
Font:
Family: "Sans"
Size: "10"
Import_dir:
AutoImport: false
Directory: "/home/apoorv/"
I want that when user changes say font, the related key value also changes with the selected option. I tried making a function that should do this like,
void Serializer::SerializeDisplaySettings(const std::string& filepath, wxFont& font)
{
YAML::Emitter out;
std::string fontFace = font.GetFaceName().ToStdString();
int fontSize = font.GetPointSize();
std::ifstream ifin(filepath);
try
{
YAML::Node config = YAML::LoadAllFromFile(filepath)[1];
auto display = config["Display"];
if (auto fontSetting = display["Font"])
{
wxLogDebug("Changing font settings");
wxLogDebug("Font face: %s", fontFace);
wxLogDebug("Font size: %d", fontSize);
out << YAML::Key << fontSetting["Family"] << YAML::Value << fontFace;
out << YAML::Key << fontSetting["Size"] << YAML::Value << fontSize;
std::ofstream ofout(filepath);
ofout << out.c_str();
}
else
{
wxLogDebug("Error! Cannot fetch values.");
}
}
catch(const YAML::ParserException& ex)
{
std::cout << ex.what() << std::endl;
}
}
but this deletes the whole and fills just font name and size. How do I modify those values without changing/deleting whole file?
ANSWER
Answered 2021-Mar-03 at 11:37You override the file, of course it only contains the items you gave to the emitter out
. If you want to modify the loaded file, you should update the values in config
and write all of it back out:
fontSetting["Family"] = fontFace;
fontSetting["Size"] = fontSize;
out << config;
std::ofstream ofout(filepath);
ofout << out.c_str();
To get the other content as well, do this when loading:
auto docs = YAML::LoadAllFromFile(filepath);
out << YAML::Comment("Hello") << YAML::BeginDoc << docs[0] << YAML::EndDoc;
YAMl::Node config = docs[1];
QUESTION
I am trying to create a config file for my application using yaml-cpp
, I am able to create map
by
YAML::Emitter emitter;
emitter << YAML::BeginMap;
emitter << YAML::Key << "Autoplay" << YAML::Value << "false";
emitter << YAML::EndMap;
std::ofstream ofout(file);
ofout << emitter.c_str();
which outputs something like,
var1: value1
var2: value2
But how would I make the top object like,
Foo:
var1: value1
var2: value2
Bar:
var3: value3
var4: value4
and so on.. How do I get the Foo
and the Bar
like in the above code.
ANSWER
Answered 2021-Jan-31 at 09:19What you want to achieve is a map containing two keys Foo and Bar. Each of these containing a map as a value. The code below show you how you can achieve that:
// gcc -o example example.cpp -lyaml-cpp
#include
#include
int main() {
std::string file{"example.yaml"};
YAML::Emitter emitter;
emitter << YAML::BeginMap;
emitter << YAML::Key << "Foo" << YAML::Value;
emitter << YAML::BeginMap; // this map is the value associated with the key "Foo"
emitter << YAML::Key << "var1" << YAML::Value << "value1";
emitter << YAML::Key << "var2" << YAML::Value << "value2";
emitter << YAML::EndMap;
emitter << YAML::Key << "Bar" << YAML::Value;
emitter << YAML::BeginMap; // This map is the value associated with the key "Bar"
emitter << YAML::Key << "var3" << YAML::Value << "value3";
emitter << YAML::Key << "var4" << YAML::Value << "value4";
emitter << YAML::EndMap;
emitter << YAML::EndMap; // This ends the map containing the keys "Foo" and "Bar"
std::ofstream ofout(file);
ofout << emitter.c_str();
return 0;
}
You have to see these sorts of structures with a recursive mindset. This code will create the example you gave.
QUESTION
I'm trying to understand how to use my linux project on windows with visual studio 2019. So I write a simple test for yaml_cpp :
#include "yaml-cpp/yaml.h"
#include
#include
#include
int main()
{
try
{
assert(1 == 2);
YAML::Node config = YAML::LoadFile("config.yaml");
std::cerr << config["hello"].as() << std::endl;
}
catch (std::exception& e)
{
std::cerr << "Caught " << e.what() << std::endl;
std::cerr << "Type " << typeid(e).name() << std::endl;
};
return 0;
}
and I write a basic CMakeLists.txt file :
cmake_minimum_required(VERSION 3.1)
project (test)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
get_filename_component(PARENT_DIR_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} DIRECTORY)
find_package(yaml-cpp REQUIRED PATHS "${PARENT_DIR_INSTALL_PREFIX}/YAML_CPP/share/cmake/yaml-cpp")
add_executable(test
main.cpp)
target_include_directories(test
PUBLIC
${PARENT_DIR_INSTALL_PREFIX}/YAML_CPP/include >
)
target_link_libraries(test debug yaml-cppd optimized yaml-cpp)
I generate the project with cmake -G "Visual Studio 16 2019" -Ax64 ..
. The program compiles and works well on Release (cmake --build . --config Release
). But in Debug (cmake --build . --config Debug
, I have the following error :
LINK : fatal error LNK1104: impossible d'ouvrir le fichier 'yaml-cppd.lib' [C:\Users\kafka\dev\C++\test\yaml_for_vs\bui
ld\test.vcxproj]
"Impossible d'ouvrir le fichier" means the file 'yaml-cppd.lib' can't be open. I have compile yaml-cpp in release and debug and the file 'yaml-cppd.lib' is present in "C:\Program Files (x86)\YAML_CPP\lib". What am I missing ?
ANSWER
Answered 2021-Jan-26 at 07:51It's definitely wierd that release file is found while debug is not. You should look at Visual Studio's test
properties page (under "Editeur de liens", check "Dependances supplémentaires" in "entrée", and "Répertoire de bibliothèques supplémentaires" in "Général", then switch between "Debug" and "Release" config and see what's different).
Anyway, here are two workarounds that may fix your issue:
Explicitely specify where libraries should be picked-up from:
link_directories( "${PARENT_DIR_INSTALL_PREFIX}/YAML_CPP/lib" )
Or, explictely specify .lib file to be linked:
target_link_libraries(test debug ${PARENT_DIR_INSTALL_PREFIX}/YAML_CPP/lib/yaml-cppd.lib optimized ${PARENT_DIR_INSTALL_PREFIX}/YAML_CPP/lib/yaml-cpp.lib)
This last one has the disadvantage of not being cross-platform (under Linux, it should be replaced by target_link_libraries(test debug ${PARENT_DIR_INSTALL_PREFIX}/YAML_CPP/lib/libyaml-cppd.so optimized ${PARENT_DIR_INSTALL_PREFIX}/YAML_CPP/lib/libyaml-cpp.so)
. But it may be an acceptable workaround if the first one does not fix your issue.
QUESTION
Im' trying to port a home made software from AIX to "Red Hat Enterprise Linux 7.8"
I'm facing "undefined reference to" errors at link time and, for now, I can't find where I screwed up.
The goal is to generate an executable from 2 homemade shared librairies (msi and atmi), some object previously compiled (MsiServices.o) and a C program (pingsrv.c). Below is the command :
gcc -DWall -o bin/pingsrv -DUNIX -I. -g -DUNIX -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -I/home/vgi/git/msi-tools/ping/server/target/msi/include/yaml-cpp -I/home/vgi/git/msi-tools/ping/server/target/msi/include/apr-1 -I/home/vgi/git/msi-tools/ping/server/target/msi/include/activemq-cpp-3.9.4 -I/home/vgi/git/msi-tools/ping/server/target/msi/include /tmp/MsiServices.o ./pingsrv.c -L/home/vgi/git/msi-tools/ping/server/target/msi/lib -lmsi -lactivemq-cpp -llog4cxx -latmi -lapr-1 -laprutil-1 -lexpat -lstdc++ -lyaml-cpp
Errors appears a link time:
/home/vgi/git/msi-tools/ping/server/target/msi/lib/libatmi.so: undefined reference to `Msi_tpreturn'
/home/vgi/git/msi-tools/ping/server/target/msi/lib/libatmi.so: undefined reference to `Msi_tpcall'
/home/vgi/git/msi-tools/ping/server/target/msi/lib/libmsi.so: undefined reference to `msi::service::optarg'
/home/vgi/git/msi-tools/ping/server/target/msi/lib/libatmi.so: undefined reference to `Msi_userlog'
Library atmi is written in C and is able to call some C++ instance methods by using wrappers:
...
typedef struct MsiScheduler MsiScheduler ;
extern void Msi_tpreturn(MsiScheduler *,int, long , char *, long, long);
extern void Msi_userlog(MsiScheduler *,char*) ;
extern int Msi_tpcall(MsiScheduler *,char *svc, char *idata, long ilen, char **odata, long *olen, long flags) ;
...
extern void tpreturn(int rval, long rcode, char * data, long len, long flags)
{
assert(vg_Consumer != NULL) ;
Msi_tpreturn(vg_Consumer,rval,rcode,data,len,flags) ;
}
Wrappers called by this library are defined in another library called msi. Wrappers are defined in a C++ source file (MsiScheduler.cpp):
void Msi_tpreturn(MsiScheduler * c,int ret,long code,char *data,long len,long flags)
{
TypedBuffer* buffer = NULL ;
if (data != NULL)
{
buffer = TypedBuffer::createBuffer(getType(data),data,len) ;
}
MsiReply * reply = MsiReply::createReply(ret,code,buffer) ;
c->tpreturn(reply) ;
if (data != NULL)
{
freebuf(data) ;
}
delete reply ;
}
int Msi_tpcall(MsiScheduler * c,char *svc, char *idata, long ilen, char **odata, long *olen, long flags)
{
...
}
void Msi_userlog(MsiScheduler *c ,char* str)
{
c->userlog(str) ;
}
header file (MsiScheduler.h) contains this fragment :
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__STDC__) || defined(__cplusplus)
extern void Msi_tpreturn(MsiScheduler *,int, long , char *, long, long);
extern void Msi_userlog(MsiScheduler *,char*) ;
extern int Msi_tpcall(MsiScheduler *,char *svc, char *idata, long ilen, char **odata, long *olen, long flags) ;
#else
extern void Msi_tpreturn();
extern void Msi_userlog() ;
extern int Msi_tpcall() ;
#endif
#ifdef __cplusplus
}
#endif
Librairies are constructed like that:
g++ -g -fPIC -Wall -I/home/vgi/git/msi/msi-service/target/ext/include/apr-1 -I/home/vgi/git/msi/msi-service/target/ext/include/activemq-cpp-3.9.4 -I/home/vgi/git/msi/msi-service/target/ext/include/yaml-cpp -I/home/vgi/git/msi/msi-service/target/ext/include -I/home/vgi/git/msi/msi-service/target/ext/include -I../lib/inc -I./ -o MsiScheduler.o -c MsiScheduler.cpp
...
g++ -shared MsiUtil.o MsiConfig.o MsiInstrumentation.o MsiMetric.o MsiService.o MsiExceptions.o MsiCharsetConverter.o MsiTypes.o MsiMessage.o MsiMessageUtil.o MsiScheduler.o MsiServer.o -o libmsi.so
...
gcc -g -fPIC -Wall -I/home/vgi/git/msi/msi-service/target/ext/include/apr-1 -I/home/vgi/git/msi/msi-service/target/ext/include/activemq-cpp-3.9.4 -I/home/vgi/git/msi/msi-service/target/ext/include/yaml-cpp -I/home/vgi/git/msi/msi-service/target/ext/include -I/home/vgi/git/msi/msi-service/target/ext/include -I../lib/inc -I./ -o atmi.o -c atmi.c
gcc -shared atmi.o memmngt.o -o libatmi.so
FYI, everything compile and link well on AIX OS (with xlc,xlC commands).
I also tried to change librairies order for linking command, without success.
I guess there is something specific to linux/gcc but I haven't found it yet.
ANSWER
Answered 2021-Jan-19 at 14:15When you're compiling pingsrv.c you try to link msi with -l. Have you put libmsi.so in the library path so that -l can find it?
QUESTION
I want to use yaml-cpp for a project of mine to generate a yaml-file however I have trouble figuring out how exactly I have to go about this. The yaml file I need to emit should look like this:
action_counts:
version: 0.3
subtree:
- name: system
local:
- name: adder
action_counts:
- name: add
counts: 1000
- name: idle
counts: 10000
So far I haven't been able to write the last four lines. I know that a '-' represents an array but I don't know how I can print the name and counts keys like that.
I have written some bits of code to experiment with yaml-cpp. The code looked like this:
YAML::Node node;
node["action_counts"] = YAML::Null;
node["action_counts"]["version"] = "0.3";
node["action_counts"]["subtree"].push_back("system");
std::ofstream fout("fileUpdate.yaml");
fout << node;
return 0;
And the output it produces is this:
action_counts:
version: 0.3
subtree:
- system
The last line here is wrong but I haven't managed to find out how to print - name: system
instead of this. How do I do this?
Once thats done how do I print the rest? Is local
a part of the - name
array? I think once I know how to format those to two lines I can figure out the rest by myself.
ANSWER
Answered 2020-Nov-17 at 10:53The value in the array is just another mapping with the keys name
and local
, so you need to put that mapping into the array, e.g.:
YAML::Node systemTree;
systemTree["name"] = "system";
/* assuming you have put together adderTree similarly */
systemTree["local"].push_back(adderTree);
YAML::Node root;
root["action_counts"] = YAML::Null;
root["action_counts"]["version"] = "0.3";
root["action_counts"]["subtree"].push_back(systemTree);
QUESTION
I have a QVariantMap created in C++ from a JSON object and I want to update this object from QML. I set it as a context property.
// main.cpp
engine.rootContext()->setContextProperty("myjson", myqvariantmap);
In QML I tried updating its properties but it seems to be read-only. The docs support this, saying
Mind that QVariantList and QVariantMap properties of C++ types are stored as values and cannot be changed in place by QML code. You can only replace the whole map or list, but not manipulate its contents.
Is there a workaround or an alternative type I can use in place of QVariatnMap?
ANSWER
Answered 2020-Nov-17 at 16:54One possible option is QQmlPropertyMap
:
#include
#include
#include
#include
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlPropertyMap qpropertymap;
qpropertymap.insert("name", "foo");
QObject::connect(&qpropertymap, &QQmlPropertyMap::valueChanged, [](const QString &key, const QVariant &value){
qDebug() << key << value;
});
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("qpropertymap", &qpropertymap);
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}
import QtQuick 2.12
import QtQuick.Window 2.12
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Component.onCompleted: {
qpropertymap.name = "bar"
// or
// qpropertymap["name"] = "bar"
}
}
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ml-cpp
You don't need to specifically build the C++ components for machine learning as, by default, the elasticsearch build will download pre-compiled C++ artifacts. Setting up a build environment for ml-cpp native code is complex. If you are specifically interested in working with the ml-cpp code, then information regarding setting up a build environment can be found in the build-setup directory. To use CLion with the project, please refer to the "Using CLion" tutorial.
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page