how to get png++ to work in windows visual studio - libpng

I get this error when compiling my code
Error 3 error C3861: 'strerror_r': identifier not found c:\program files (x86)\microsoft visual studio 12.0\vc\include\png++\error.hpp 108 1 Depth-Estimation
I read at http://savannah.nongnu.org/bugs/?47990 it is because
In Visual Studio 2015 (14.0.25123.00 Update 2) the definition _STDC_LIB_EXT1_ is not set, meaning that in error.hpp it tries to fall back to strerror_r which isn't available anymore.
Because _STDC_LIB_EXT1_ is not set, _STDC_WANT_LIB_EXT1_ is not defined, string.h is not included, and HAVE_STDERROR_S is not defined.
How do I fix this ?

I had the same problem in CodeBlocks.
You can change the line 108 that was:
return std::string(strerror_r(errnum, buf, ERRBUF_SIZE));
to
return std::string("");
While this should resolve the error and enable you to use png++ in your project, I'm guessing error reporting will no longer work properly.

Maybe you will never read this but hey, you never know.
Anyway, I just had the same problem, my fix:
Add
#define strerror_r(errno,buf,len) strerror_s(buf,len,errno)
Then change
return std::string(strerror_r(errnum, buf, ERRBUF_SIZE));
to
strerror_r(errnum, buf, ERRBUF_SIZE);
return std::string(buf);

Related

Visual Studio 2019 is configured for:c++17 but it looks more like c++14

If I compile some code with the following:
#include <string_view>
std::string_view strv{ "Test 1" };
I get this error:
Error C2065 'string_view': undeclared identifier...
I tried some other c++17 code and not of it works.
I get the same errors if the C++ Language Standard is set to std:c++14
The Properties-->C/C++-->Command line contains /std:c++17
but the actual compiler command line that runs does not have this option set.
This is a community version of Visual Studio 2019 version 16.7.1
user dxiv pointed out the problem is in the Property pages Platform pulldown it should be set to ALL Platforms (or set C++17 individually for Win32 and x64 platforms).

Uncaught lua exception error in zerobrane, any solution?

Zerobrane version v1.90
This error is caused after I put the following code into user preference:
styles.indicator.fncall = {fg = {-110,0,0}} --I got this in documentation page of zerobrane
I tried to reinstall zerobrane(both portable version and .exe verison) but the problem is still here.
Screenshot of the error message:
{-110,0,0}
You're passing a negative value as the red value; there's no way that could work (What would it even do?)

The type provider 'ProviderImplementation.JsonProvider' reported an error despite program working

I am writing a service using .net Core with Visual Studio 2017. I want to use JSON for the configuration, so I defined my type like this:
type ServiceConfig = JsonProvider<"exampleConfig.json", EmbeddedResource="MyService, exampleConfig.json", SampleIsList = true>
In my program, I load it like this:
let conf = ServiceConfig.Load "config.json"
When I run it, it works fine, but in VS 2017 I get a red squiggly line and the error log says:
FS3033 The type provider 'ProviderImplementation.JsonProvider'
reported an error in the context of provided type
'FSharp.Data.JsonProvider,Sample="exampleConfig.json",SampleIsList="True",EmbeddedResource="MyService, exampleConfig.json"', member 'Load'. The error: Method
'FSharp.Data.Runtime.BaseTypes.IJsonDocument
Create(System.IO.TextReader, System.String)' not found in type
''. This method may be missing in the types available in the
target assemblies.
How do I get rid of this?
I'm not sure that this is the problem, but it might help to give an absolute path of the sample file. Resolving a relative path is a constant source of issues in type providers. You can do something like:
[<Literal>]
let sample = __SOURCE_DIRECTORY__ + "/exampleConfig.json"
type ServiceConfig =
JsonProvider< sample, EmbeddedResource="MyService, e
xampleConfig.json", SampleIsList = true >
By chance I found the answer myself. It must have been some Visual Studio index having gone wonky. I had another problem with another project in my solution so I just did an "emergency commit" to git, cleaned my local working copy using git clean -fdx and then reloaded the solution, rebuilt everything and the errors went away.

Compiling jabber-net in Xamarin Studio

I am trying to compile jabber-net in Xamarin Studio so I can use it in a Xamarin.iOS app.
From other searches I have done I am told I need to recompile the source.
From command line I can build the dll, but I have no idea what version of .NET/Mono this is targeting.
This makes a jabber-net.dll and a jabber-net.dll.mdb.
If I add jabber-net.dll to my project, add the reqiured
using jabber.client;
...
...
...
JabberClient client = new JabberClient ();
and try to compile I am told.
/Users/brad/Projects/XMPPChat/XMPPChat/AppDelegate.cs(37,47): error CS0584: Internal compiler error: Could not import type jabber.client.JabberClient' fromjabber-net, Version=2.1.0.702, Culture=neutral, PublicKeyToken=924c5b18328d6f09'
/Users/brad/Projects/XMPPChat/XMPPChat/AppDelegate.cs(37,38): error CS0584: Internal compiler error: Could not import type jabber.client.JabberClient' fromjabber-net, Version=2.1.0.702, Culture=neutral, PublicKeyToken=924c5b18328d6f09'
/Users/brad/Projects/XMPPChat/XMPPChat/AppDelegate.cs(37,38): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
I got no idea what is going on here...
When I try to open any of the .sln's (or include any of the existing projects, even the mono specific project) that came with jabber-net into my solution it will either hang trying to convert the project, or will tell me
The file '/Users/brad/Projects/XMPPChat/JabberNet-2.1.0.710/mono-jabber-net.csproj' could not be loaded.
and will spit out this error.
Any idea where to go from here? :|
Start a new solution from scratch, and add all of the .cs files except those in the test and examples directories. Also make sure you don't have an old version of the .dll around somewhere.

Compilation error Problem with 10000 lines pas file in Delphi XE

I have a unit with 10000 rows for which I already asked a question in the past.
Anyway the problem now is that I just migrated from 2009 to XE. And everytime I compile that unit (or build my application) I get an error:
[DCC Error] 10000linesuni.pas(452): E2029 ',' or ':' expected but identifier 'dxBarLargeButton17' found
The workaround is to do a dummy modification to the pas file (add a '.' and remove it). Now it will compile correctly.
Is this a known problem? Does anyone know a workaround?
Note: I didn't have this problem in Delphi 2009.
This is the code you can see that 452 is nothing special, just one of the components on the form:
BarManagerBar4: TdxBar;
dxBarLargeButton16: TdxBarLargeButton;
dxBarLargeButton17: TdxBarLargeButton; // This is line 452
dxBarLargeButton18: TdxBarLargeButton;
dxBarLargeButton19: TdxBarLargeButton;
dxBarLargeButton20: TdxBarLargeButton;
user193655, as the advice in my comment helped you, I will post as answer to help someone in the future to resolve this issue.
Sometimes the compilation of one or more files is interrupted due to the existence of invalid characters in the source code or mismatched line endings (should be CR/LF). To fix this use a hex editor to track the invalid chars and delete from the source file, or in the case of the line endings, open the file in Notepad, and save it; this fixes the line endings correctly.

Resources