I have some code that manages SSL and SSL_CTX pointers with unique_ptr.
The following code compiles with OpenSSL 1.0.2, but not with OpenSSL 1.1.1:
std::unique_ptr<SSL> m_pSession
I include 'openssl/ssl.h', but with OpenSSL 1.1.1 I get the following compile error (using Visual Studio):
error C2027: use of undefined type 'ssl_st'
I have googled a little and it seems that the later version of OpenSSL does not provide the real declaration of ssl_st anywhere? What would be the solution to this?
With the help of the OpenSSL forum I got to the following solution.
Defined a custom deleter for unique_ptr:
struct SslDeleter {
void operator()(SSL *_p)
{
SSL_shutdown(_p);
SSL_free(_p);
}
void operator()(SSL_CTX *_p)
{
SSL_CTX_free(_p);
}
};
Use a typedef to easily work with the smart pointers:
using UniqueSslPtr = std::unique_ptr<SSL, SslDeleter>;
and
using UniqueCtxPtr = std::unique_ptr<SSL_CTX, SslDeleter>;
The custom deleter works for SSL and SSL_CTX and should also work for shared_ptr.
Related
In my code I'm using both these two namespaces and all works fine until I try to use the CopyStatus that exists in both. This piece of code works just fine in LINQPad5 with the exact same namespaces, however in VS2019 I'm finding that it cannot fine CopyState in the Storage.File class.
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.File;
Code from LINQPad5
CloudFile file = share.GetRootDirectoryReference().GetFileReference(myfile);
string blobSas = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy()
{
Permissions = SharedAccessBlobPermissions.Read,
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(24)
});
Uri blobSasUri = new Uri(blob.StorageUri.PrimaryUri.ToString() + blobSas);
file.StartCopy(blobSasUri);
file.FetchAttributes();
int count=0;
while (file.CopyState.Status != Microsoft.WindowsAzure.Storage.File.CopyStatus.Success)
{
Thread.Sleep(1000);
Console.WriteLine(#"{0} - Sleep one second", count++.ToString());
file.FetchAttributes();
}
But this (almost) same code does not work in VS2109.
file.StartCopy(bpe.BlobUri);
file.FetchAttributes();
while (file.CopyState.Status != Microsoft.WindowsAzure.Storage.File.CopyStatus.Success)
Picture showing Microsoft.WindowsAzure.Storage.File.CopyStatus does not
exist.
This issue could be mainly caused by a missing nugget from VS 2019, I'd recommend installing the latest WindowsAzure.storage Nugget found here
Restart VS then retry again.
The solution was to upgrade to .NET framework 4.7.2 and install Microsoft.WindowsAzure.Storage.DataMovement instead of Microsoft.WindowsAzure.Storage in NuGet.
Then qualifying the using statements:
using AF=Microsoft.WindowsAzure.Storage.File;
using AB=Microsoft.WindowsAzure.Storage.Blob;
The following code is responible for getting a string from HTTP Server
while (client.connected())
{
if (client.available())
{
String line = client.printRedir(url3, host);
Serial.println(line);
}
}`
Error Message:
no matching function for call to 'HTTPSRedirect::printRedir(String&,
const char*&)
How to store the response string from server
The use of HTTPSRedirect library makes the task much simpler by avoiding the need of any third party service. So, the first thing you need to do is to copy the HTTPSRedirect library files from GitHub and install into your Arduino libraries folder. I have also posted the zipped library files at the following link for convenience.
Download HTTPSRedirect Library
Update: The above library is outdated.
Please go to GitHub Sujay Phadke and download the updated library. Thanks Sujay.
from above discussion it must be you are using old version of HTTPSRedirect library,
to get new got to [Updated Library ] and download the library and copy the HTTPSRedirect folder from zip folder into the Arduino Ide libraries.
the above process solved my issue.
Define the host as below
const char* host = "your host";
And for string use
String url = "your complete url";
This is a new computer setup. All code compile and run on my old comupter.
I have 2 project in my solution than use typescript.
The first compile without problem.
The second one show error on compile but generate js on save.
I have installed vs 2013 update 5 then installed typescript 1.8.5.
I alsow have vs2015 installed.
After vs2015 was installed i have repair the typescript sdk.
They must have 2 different compiler setup and one in my project is not set correctly.
I have dig into the csproj and compare the 2 project but did not find missing/different parameter for typescript ....
It's like it dont take the new version. I get syntax errors in code i know it compile.
if someone had this problem, please help me.
p.s excuse me for my bad english, im french ...
UPDATE: Exemple of code dont compile
public doSomething(errorCallBack?: (failCallback1?: JQueryPromiseCallback<any> | JQueryPromiseCallback<any>[], ...failCallbacksN: Array<JQueryPromiseCallback<any> | JQueryPromiseCallback<any>[]>) => void)
{}
Error :
Error 218 Build: ',' expected.
A reduced sample code that fails to compile:
class Foo {
public doSomething(errorCallBack?: (failCallback1?: any, ...failCallbacksN: Array<any>[]>) => void)
{ }
}
You have major syntax errors in ...failCallbacksN: Array<any>[]>. You need something like ...failCallbacksN: Array<any> e.g.:
class Foo {
public doSomething(errorCallBack?: (failCallback1?: any, ...failCallbacksN: Array<any>) => void)
{ }
}
but js get generated
This is by design. Valid JavaScript will always generate valid TypeScript (even in the presence of errors). The types are considered invisible to the emitter in TypeScript so even in the presence of type errors TypeScript will try and do graceful recovery and generate JavaScript.
More
See Why TypeScript : https://basarat.gitbooks.io/typescript/content/docs/why-typescript.html
I have found than visual studio IDE was using 1.8.9 and the compiler was 1.0. This is why i had such compilation errors.
when i used "tsc -v" command in vs2013 command prompt, it show 1.0.
when i use "where tsc" it show only directory for 1.0 and not the 1.8.9.
so, i have replaced the 1.0 content with 1.8.9 . I dont use 1.0.
Now i have a 1.0 directory wish have 1.8.9 in it.
I think this is not the way it's supposed to be, but i need it to work.
It have a .target file i can modify, but i dont wish to do that.
I compiled a vala program by using following command:
valac test.vala
Of course am I able to run the program on my computer, but when I am trying to run the .exe file on a different one I get following error:
libglib-***.dll is missing on this computer
This is how my source code looks like:
using GLib;
int main(string[] args)
{
bool running = true;
while(running)
{
print("Hello World\n");
}
return 0;
}
The error is pretty clear, but what can I do against it? Thanks in advance.
Along your exe file you will need to install all the libraries you use (glib, gio, etc ...) and their own dependencies (Gtk will require gdk,cairo,pango, and some more).
Edit: take a look at this question on SO, the minimal dependencies are listed.
I know these questions have been asked before but everything suggest using GNUStep. Is there a way to use Foundation without GNUStep? This is also a learning question for me (like if it's possible to do by linking files or something)
I have Cygwin and gcc installed. I got all the Libraries from CocoaTron as in here: http://code.google.com/p/cocotron/source/browse/
I added the library folder to the OBJC_INCLUDE_PATH and the C_INCLUDE_PATH and it doesn't complain about not being able to find Foundation.h anymore.
But I get other errors like:
$ gcc intro.m -o intro
In file included from /cocoa/CoreFoundation/CFBase.h:144,
from /cocoa/CoreFoundation/CFAttributedString.h:8,
from /cocoa/CoreFoundation/CoreFoundation.h:42,
from /cocoa/Foundation/Foundation.h:37,
from car.h:1,
from intro.m:2:
/cocoa/CoreFoundation/CFString.h:88: error: parse error before "va_list"
In file included from /cocoa/Foundation/NSAffineTransform.h:9,
from /cocoa/Foundation/Foundation.h:41,
from car.h:1,
from intro.m:2:
/cocoa/Foundation/NSGeometry.h:9:32: Foundation/NSObject.h: No such file or directory
In file included from /cygdrive/d/Allebrum Resources/C Libraries/cocoa/Foundation/NSAffineTransform.h:9,
from /cygdrive/d/Allebrum Resources/C Libraries/cocoa/Foundation/Foundation.h:41,
from car.h:1,
from intro.m:2:
I'm sorry for the novice question, I was just interested in running a few test and didn't want to install GNUStep.
I mean, a really simple example like:
//car.h
#import <Foundation/Foundation.h>
#interface Car : NSObject{
}
- (void)addGas;
#end
#include <stdio.h>
#import "car.h"
int main(int argc, const char * argv[]){
printf("Hello");
return 0;
}
Yes, I know this example doesn't need objC ;) I was just trying to follow along with a tutorial.
Thanks for the help!
Looking at the Cocotron's requirements page and general information page, it seems that it only supports development on the Mac. What it provides is the ability to build a Windows- or Linux-compatible product… on your Mac.
So, as far as I can tell, at this time, you can't use Cocotron to develop on Windows. You'll still have to use GNUstep.