Recently I have got a small C++ SOAP client project (ubuntu linux) to build using gSOAP. I am using 2 web service classes which I believe I have created correctly according to the documentation. However, I am having problems with my code
#include "envH.h"
#include "betfairBFGlobalServiceProxy.h"
#include "betfairBFExchangeServiceProxy.h"
//#include "betfair.nsmap"
#include <iostream>
#include <string>
// Following included to prevent ligsoap++ complaining of undefined references
// to 'namespaces'
SOAP_NMAC struct Namespace namespaces[] = {};
using namespace std;
using namespace betfair;
int main()
{
BFGlobalServiceProxy bf;
BFExchangeServiceProxy betfair2; /* CRASH!! */
return 0;
}
I want to make API calls to both web services but my program crashes at the point where the second service proxy object is created. I have used wsdl2h -gbetfair option and soapcpp2 -i -n options and created a new env.h file as requested in the documentation when creating multiple client services using C++ namespaces to avoid linker errors when linking to libgsoap++ . Can anyone see what I am doing wrong???
I cannot reproduce the problem, so I'm not sure about my guess. The array namespaces is defined inside .nsmap files. Your code has a comment in the #include of .nsmap file and maybe gSOAP don't like if this array is empty. You really have to keep the #include "betfair.nsmap" commented out?
Related
I have written code in a .NET Framework C++ file. The code uses the Articares DLL to connect with the device through an IP address. Where instance is simply creating an instance of the classes I want to use from the DLL. instance.EstablishConnection() is the function i want to call from the class.
The below code works perfectly in x86.
#include "pch.h"
#include "windows.h"
#include <iostream>
#include <chrono>
#include <thread>
#include<cstring>
#include <vector>
#include "Complex.h"
using namespace System;
using namespace Articares;
using namespace NLog;
int main(array<System::String^>^ args)
{
//Creating instances of the classes ----------------------------------------------------
Articares::Core::ArticaresComm instance;
Articares::Core::HMANData instance2;
Articares::Core::TargetParams instance3;
//Connecting to HMan -------------------------------------------------------------------
instance.EstablishConnection("192.168.102.1", 3000);
std::cout << "Connection with HMan established\n";
return 0;
}
However, i want to be able to use the DLLs in the unreal engine C++ file to replicate this code i have written.
But the error name must be a namespace name appears when i try to declare the DLLs in the unreal engine C++ file.
Could anybody tell me how to fix this problem to be able to use my x86 DLLs in the unreal engine C++ code?
Thanks.
Are you using C++ DLL or . NET DLL?
For C++ DLL, you need to add dependencies. Walkthrough: Create and use your own Dynamic Link Library (C++)
For .NET DLL, You are calling managed code in unmanaged C++.
Use Exposing .NET components to COM
For your reference: using c# dll in project c++
I recently installed CGAL from their website. I used the native installer that is up to download on the website, and after selecting a directory, the installation completed. I am looking through the User Manual and trying to run some basic code, but I keep getting a compiler error. The code that I run is this (it is straight from the user manual):
// example: construct a quadratic program from data
// the QP below is the first quadratic program example in the user manual
#include <iostream>
#include <cassert>
#include <CGAL/basic.h>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
// choose exact integral type
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz ET;
#else
#include <CGAL/MP_Float.h>
typedef CGAL::MP_Float ET;
#endif
int main()
{
}
It is just a simple QP problem, using the syntax straight from the website. However, when I try to run it, I receive this compiler error:
C:\...\include\CGAL\config.h|161|fatal error: CGAL/compiler_config.h: No such file or directory|
I used the installer straight from the website, but CGAL is still giving me these issues. Does anyone know how to solve it? Thank you.
According to the documentation (https://doc.cgal.org/latest/Manual/installation.html#title5), after installing CGAL on Windows, you still need to build the library itself.
This process will (I suspect) create the missing configuration files according to the compiler you have (gcc 7.3).
I am getting an error saying namespace "bsoncxx::v_noabi::builder::basic" has no member "make_document", I have already added required included as per mentioned in the tutorial.
I am using mongo-cxx-driver-r3.1.1 version.
i have followed example from here
here is what I have tried
#include "maxi.h"
#include <cstdlib>
#include <iostream>
#include <bsoncxx/builder/basic/array.hpp>
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/builder/basic/kvp.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::basic::make_document;// here is error
using bsoncxx::type;
mongocxx::instance inst{};
mongocxx::client conn{ mongocxx::uri{ "mongodb://localhost:27017" } };
see image here
I have already tested MongoDB driver after compiling and its working perfectly. I need to use make_document option for some reason in order to achieve my goal.
Not sure possible bsoncxx::builder::basic::make_document; option may have been removed or replaced with something else which I don't know.
In the current master branch, document.hpp file contains make_document method.
if I'm not mistaken you are using stable release version.
Take a look here.
Using declaration “not found” in MongoDB c++ driver
I'm using GMP and getting an illegal instruction that I have found to be caused by mpf_set_d. I'm programming in Netbeans with cygwin in c++.
Thanks in advance!
Edit:
I have a folder containing the following files:
.dep.inc, cyggcc_s-seh-1.dll, cyggmp-10.dll, cyggmpxx-4.dll, cygstdc++-6.dll, cygwin1.dll, my executable, gmp.h, gmpxx.h, libgmp.a, libgmp.la, libgmp.lai, libgmp.lai, libgmp.libcmd, libgmpxx.a, libgmpxx.la, libgmpxx.lai, main.cpp, main.o, main.o.d, Makefile, text file needed for program and folders needed for program.
I have tried many things, one of which was to add an executable to this folder that ran the following code:
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include "gmpxx.h"
#include <stdarg.h>
#include <string>
using namespace std;
int main()
{
mpf_t a;
mpf_init(a);
mpf_set_d(a,3.1415926535);
cout << "works" << endl;
}
Running this on my own computer with GMP installed gives me 'works' after which it closes, on another computer that does not have GMP installed it throws an error and closes. The error is an exception: status_illegal_instruction.
I can't give you my code but I can post snippets. Please tell me if more information is necessary!
Thanks again.
Edit 2:
The same counts for mpf_set_str as well as the c++ wrapper.
I've been following Thrift C++ wiki tutorial. and everything works fine with TSimpleServer.
But, when I try to implement TNonblockingServer I'm getting this error :(
undefined reference to `apache::thrift::server::TNonblockingServer::serve()
undefined reference to `apache::thrift::server::TNonblockingServer::~TNonblockingServer()
I think its something related to the header files or the namespaces.
The following headers im using:
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/concurrency/ThreadManager.h>
#include <thrift/concurrency/PosixThreadFactory.h>
#include <thrift/server/TThreadedServer.h>
#include <thrift/server/TNonblockingServer.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace ::apache::thrift::concurrency;
any idea whats wrong?
I understand that this is really late reply.
It is due to missing libthriftnb library for TNonblockingServer.
while Tsimplesever and TThreadedServer are in libthrift library so it was works with you.