ZXing Library: Errors in iOS: private field 'cached_y_' is not used - c++

I am currently trying to use the ZXing Library for an iOS Project. However I can't even get the sample Projects to work.
The ScanTest Project, as well as the ones that I created myself throw the following error in the BinaryBitmap.cpp file.
In file included from /Volumes/Macintosh HD/Users/Tim/Downloads/zxing-2.1/iphone/ZXingWidget/../../cpp/core/src/zxing/BinaryBitmap.cpp:20:
../../cpp/core/src/zxing/BinaryBitmap.h:33:7: error: private field 'cached_y_' is not used [-Werror,-Wunused-private-field]
int cached_y_;
^
1 error generated.
I searched on Google and Stackoverflow, but have not found a solution for the problem.
I have tried it with both the current stable release of XCode and the beta.
I don't know if anybody else has got this problem too, but any help would be greatly appreciated.

This is clang, right? You can read about the relevant compiler options here.
The error message is telling you which compiler flags are relevant.
-Wunused-private-field means you get warnings about private member fields of classes (or structs, ...) that are not used anywhere. The warning is because you probably did mean to use them. This would not normally stop the compilation, but...
-Werror turns warnings into errors. A lot of people use this option to force themselves to write very clean code. Taking this one out should be enough.

Related

internal compiler error: in decode_addr_const, at varasm.c:2632

When I compile a project using cross compiler,I come across the following error:
internal compiler error: in decode_addr_const, at varasm.c:2632
Where can I find the varasm.c file?I searched the project directory and cross compiler directory,but I didn't find it.
Thanks for helpping,Light
The compiler maker has that file, and probably won't give it to you.
But as it seems to be an error in the compiler, you can either contact them / file a bug report, or try to avoid the error by changing your code a bit (which is a guessing game, as you don't know how you made it run into the error). Or use another compiler, if there are choices.

Why am I NOT getting C4192 when importing msxml6?

We been instructed to eliminate all level 3 warnings and have been specifically told to address C4192.
My code does fall into the "bad code" example that causes C4192
#import "msxml6.dll" named_guids
and the "good code" is easy enough to implement
#import "msxml6.dll" exclude("ISequentialStream","_FILETIME")named_guids
The only problem, is that I just do not get this warning. I'm importing version 6.30.7601.18431 of msxml6.dll, and no matter what I do, this warning just does not manifest.
I also imported it again, specifying the no_auto_exclude option and could find no reference to ISequentialStream or _FILETIME in the generated tli and tlh files.
I'm about to simply update to use the "good" code and go on, but I'd still like to know what is happening.
This is specifically an issue because new version of MSXML6.0 changed declarations , especially from Win10 OS onwards.
We already encountered this warning message with our legacy code base having 'bad code' , which you mentioned in your question.
In your case, your system is having older version of MSXML6.DLL (present in "C:\Windows\System32 or SysWow64").
Hope this calrifies your query.

error: ‘fileno’ was not declared in this scope

I am running Cygwin on windows 8, attempting to compile the source code for a game I would like to mod. Unfortunately I am running into some errors while building involving the fileno function. After doing some googling It seems like the problem might have to do with c++11 support (I'm not really sure what this means). Most of the solutions people have found involve adding some option like -std=c++0x or -std=c++11 when compiling, but my attempts to add the options into the makefile have been unsuccessful, and I don't know if that's whats causing the problem anyways. I'll include the code snippet that's throwing the error and a link to the makefile as it is quite large. Any advice you could give me would be great.
code that throws error:
time_t file_modtime(FILE *f)
{
struct stat filestat;
if (fstat(fileno(f), &filestat))
return 0;
return filestat.st_mtime;
}
Link to Makefile
it is being hosted on github
EDIT: After getting some advice I poked around the makefile and found five instances where the -std option was used, playing around with them hasn't changed anything. Is the problem with my Cygwin configuration? I installed the packages I was told I would need in the installation guide for the game I am building.
Changing the -std=c*** in your makefile to -std=gnu++0x should fix your problem.
If you don't know what c++11 is you're most likely not using it anyway.
Also if you need c++11 support you can also do: -std=gnu++11 instead of -std=gnu++0x
For windows...
fileno() is deprecated: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/posix-fileno?view=vs-2017
use _fileno() instead: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fileno?view=vs-2017

Build error referring to yvals.h in a cantata++ test project

I am testing c++ source codes using the tool cantata++. I created a project, built it and encounter the following error message.
error I9282: the global scope has no "_invalid_parameter" C:\LegacyApp\VisualStudio2005\VC\include\yvals.h 167
I find this error wierd, because yvals.h is not really a file in my source codes. What does this error message imply?
You'll find that yvals.h is probably included by one of the many system header files the Microsoft compiler includes, and you are only seeing it in the error message because the Cantata++ instrumenter is finding a problem with it. My guess would be that there is some problem with the settings in either Cantata++, your Visual Studio project or a mismatch between the two meaning they are not using the same settings.
In order to help diagnose the problem it would help to know a few things about the setup you have, and the code you are building when you get the error.
As Joachim Wuttke said, I would suggest you contact the Cantata Technical Support team directly if you are still having problems with this issue. They will be able to provide you with further information to help solve the problem.

Basic example code compiling help required - I can't get any SDK examples to work

I'm very new to C++; I've worked with several SDKs now on various applications and every time come across the problem that I can't get the 'example code' to compile. This is a very broad question basically regarding ANY example code that is given over the net - what is the standard procedure to make things compile? I know how to compile code that I've written myself but when given a large project containing several CPP and H files, what do I start with? My first port of call, to open 'main.cpp' in Dev-C++ and hit the 'compile' button generally throws up errors about header files not being available and so on.
I won't give a specific example as this has happened several times. I feel as someone getting to grips with C++ that I would learn a lot quicker if I could start with code that works and tweak it myself rather than having to fumble around building things up piece by piece.
The most recent example is a set of example code provided by a company which 10 files:
-Arial.ttf
-demo_resources.rc
-icon.ico
-main.c
-simple.dsp
-simple.dsw
-simple.exe
-simple.h
-trial.c
-trials.c
Running the .exe file works absolutely fine; however if I open main.c and press compile, I receive many error messages. As an example, the first two lines of code in main.c are:
#include "simple.h"
#include <sdl_text_support.h>
This alone spews the error messages:
1: expected unqualified-id before "public"
1: expected `,' or `;' before "public"
2: In file included from trial.c
Clearly I am doing something very wrong as this code must have compiled for someone else in the past to have generated the .exe file. Again this is not an isolated issue, I have this problem all the time.
Since Dev-C++ is perfectly equipped to deal with plain old C files, I can't see that that is the issue. Secondly, simple.h is definitely included in the correct directory. The second include though, sdl_text_support.h is obviously not in my file list above. I have searched the rest of the SDK and found the file lurking elsewhere. How do I explicitly reference the location of the header file using Dev-C++?
Any general tutorial to how to compile pre-made projects or help of any kind would be greatly appreciated.
I like this page:
http://www.cprogramming.com/tutorial.html
I am not familiar with DevC++, but you cannot assume that if you can open main.c and press a button, then everything will work out. No build system is that smart.
If you write your own code (and you understand compiling and linking) then you can keep your files in order and know exactly how to build everything; someone else's codebase may come with a makefile or some other guide to it's organization, but you'll have to learn how to use a good build system, and the one you're using sounds inadequate.
open the project by simple.dsw instead of main.cpp and it should work .