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

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.

Related

In Visual Studio C++, How to quickly find necessary header files?

I know a fair amount of Java and Eclipse IDE, but am new to Visual Studio and C++. In Eclipse/Java, if you use a predefined class, Eclipse helpfully suggests the appropriate header file to include for the code to compile. Wondering if Visual Studio has similar functionality.
For example every time I use a code sample from the web, I spend a lot of time Googling which header files to include so the code will compile. My current challenge: I'm writing a small utility that reads filenames in a directory into an array for batch renaming. For this, I'm using following code fragment:
DIR* dir;
struct dirent* dirEntry;
dirEntry = readdir(dir);
Visual Studio is giving the error message: "DIR" is unidentified. "readdir" is unidentified.Is there an efficient way to locate the appropriate header files for C++ code fragments to resolve error messages like these? Thanks.
I tested this feature in vs2019 community 16.3.6 and it works. When you hover the mouse at the location of an error, you can see an error light bulb. And click the drop-down arrow next to the error bulb to add missing #include.
You can also press Alt+Enter.
As mentioned in some answers above, Visual Studio has started offering some suggestions for header files. But as of this writing, some VS suggestions lead to other error messages. E.g. I just used getline(). VS gave error message: Identifier "getline" is unidentified. It suggested I add using namespace std::basic_istream; to my code. But this was not applicable to my code and produced additional error messages.
After stumbling around, I found a very simple solution: Visit the C++ reference website. There I searched for getline and found the header information at the following link: getline(). To fix the error, I needed to #include <string>.

There are too many errors for the IntelliSense engine to function correctly

Please leave the window-installer tag in - this Q/A is not for
C++ experts, but for people like me, who use C++ when they have to.
They may face this potential time-waster, and need a quick fix to get
msi.h or other includes operational quickly. VS2017 templates must
have changed quite a bit - I didn't see this issue before.
Visual Studio 2017 Community Edition with all available C++ components installed (perhaps this problem does not exist in the professional edition?).
File => New => Project... => Visual C++\Windows Desktop\Windows Console Application => OK.
Do a quick test build to verify there are no errors. Right click solution => Build. As stated no errors should show up.
Now add this include for msi.h directly below #include stdafx.h right above the main() function in the console appliation's CPP file:
#include <msi.h>
// And just to make things link:
#pragma comment(lib, "msi.lib")
A red error chevron should show up in the top left corner at the start of the first line comment saying on hover: "There are too many errors for the IntelliSense engine to function correctly, some of which may not be visible in the editor. PCH warning: an unknown error occurred. An IntelliSense PCH file was not generated."
Doing a build now should reveal numerous errors. In my case from wincrypt.h - and it got me thinking about WIN32_LEAN_AND_MEAN - see answer below. I thought such basics would already be included.
I keep seeing this problem in all new C++ Windows Console Application projects, but when I try in an older project created with Visual Studio 2013 it compiles correctly with msi.h included along with the link pragma.
Judging from the error message there must be something wrong with the precompiled header (PCH). This is what threw me off.
UPDATE: Others have asked about the same error message for other include files (not MSI related). I guess this is a generic problem that strikes every now and then - probably with classes that are in little use (or include Windows.h - perhaps)?
As a general suggestion this might be a hidden dependency problem (an include that is missing), or an incorrect order of the include files (you need to change the order of your includes for some technical reason that is not immediately obvious) or a incorrect or missing define (like seen in the answer below the line underneath). My take on it: get on github.com and search for similar sample code.
These issues can be quite clunky to work out for those of us who need C++ occasionally, and otherwise be "well known" for the C++ pros (who fix it in seconds as second nature). C++ pros: please keep in mind that issues such as these can kill a whole day's worth of productivity for those of us forced to clunk around with C++ when we need to - and have no C++ pros around to ask - terrible situation that! :-) - I hereby declare a "be nice to your C++ guru - if you got them - day!").
In stdafx.h, try adding this after #pragma once and before other includes:
#define WIN32_LEAN_AND_MEAN
// Windows Header Files:
#include <windows.h>
Now try to rebuild your solution and see if the problem has disappeared.
Though simple, the strangeness of the error message (seen in the question above) can throw people off course trying to figure out what is wrong. Also, this behavior seems new in VS2017 - template change.
It looks like including <atlstr.h> will also work, so that probably makes my problem more obscure. Could have sworn I tried this though - maybe after I made project settings changes that made it fail still (exactly what I hope to help others avoid).
If only these basic includes could be present in the file but commented out so they could be enabled quickly in sequence for testing - without any fuss.

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.

What's the cause of a D8049 error in visual studio?

I'm creating a project with openframeworks (the full source is here: https://github.com/morphogencc/ofxAsio/tree/master/example-udpreceiver), and the empty project seems to compile fine.
I added the ASIO library, and a few header classes, and now the project seems to be give me the following error:
1>------ Build started: Project: example-udpreceiver, Configuration: Debug x64 ------
1> main.cpp
1>cl : Command line error D8049: cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c1xx.dll': command line is too long to fit in debug record
1>cl : Command line error D8040: error creating or communicating with child process
I couldn't find any examples of error D8049 on stackoverflow or even on Microsoft's pages, and google turned up painfully few results. The only remotely useful one was this github issue:
https://github.com/deplinenoise/tundra/issues/270
But I'm still not sure what's causing the problem. Is anyone familiar with this error, and can recommend a method for troubleshooting what's causing it?
thanks in advance!
For me, working with UE4, this was an intermittent error.
I added "bLegacyPublicIncludePaths = false;" to the innermost block of project.Build.cs and recompiled without errors.
Then I removed that line and compiled again w/o errors.
The error message suggested adding "DefaultBuildSettings = BuildSettingsVersion.V2;" to project.Target.cs which worked.
This is a bit of a weird sounding error, as it is from essentially internally generated data. However, you do have control over that. Taking the error message at face value, you probably have many/lots of defined symbols passed in on the command line (or the the ones you do have have lengthy definitions), or you may have some lengthy file paths.
If you look under the project properties, one of the selections under the C++ section is "Command Line", which will show you exactly what gets passed to the compiler. When you view that you can see where you have many or lengthy parameters, and then make changes to shorten them.
Too many defines? Put them in a header (possibly stdafx.h) and include them that way.
Long file paths? Shorten the paths, put the files somewhere else, or set up file system aliases to your real directories that use shorter paths.

C++ Compiler Error C2371 - Redefinition of WCHAR

I am getting C++ Compiler error C2371 when I include a header file that itself includes odbcss.h. My project is set to MBCS.
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\odbcss.h(430) :
error C2371: 'WCHAR' : redefinition; different basic types 1>
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(289) :
see declaration of 'WCHAR'
I don't see any defines in odbcss.h that I could set to avoid this. Has anyone else seen this?
This is a known bug - see the Microsoft Connect website:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98699
The error doesn't occur if you compile your app as Unicode instead of MBCS.
There are a half-dozen posts on various forums around the web about this - it seems to potentially be an issue when odbcss.h is used in the presence of MFC. Most of the answers involve changing the order of included headers (voodoo debugging). The header that includes odbcss.h compiles fine in it's native project, but when it is included in a different project, it gives this error. We even put it in the latter project's stdafx.h, right after the base include for MFC, and still no joy. We finally worked around it by moving it into a cpp file in the original project, which does not use MFC (which should have been done anyway - but it wasn't our code). So we've got a work-around, but no real solution.
This error happens when you redeclare a variable of the same name as a variable that has already been declared. Have you looked to see if odbcss.h has declared a variable you already have?
does this help?
http://bytes.com/forum/thread602063.html
Content from the thread:
Bruno van Dooren [MVP VC++] but i know the solution of this problem.
it solves by changing project setting of "Treat wchar_t as Built-in
Type" value "No (/Zc:wchar_t-)". But I am using "Xtreme Toolkit
Professional Edition" for making good look & Feel of an application,
when i fix the above problem by changing project settings a new
linking errors come from Xtreme Toolkit Library. So what i do to fix
this problem, in project setting "Treat wchar_t as Built-in Type"
value "yes" and i wrote following statements where i included wab.h
header file. You can change that setting on a per-codefile basis so
that only specific files are compiled with that particular setting. If
you can solve your problems that way it would be the cleanest
solution.
#define WIN16
#include "wab.h"
#undef WIN16
and after that my project is working fine and all the things related to WAB is also working fine. any one guide me, is that the right way
to solve this problem??? and, will this have any effect on the rest of
project?? I wouldn't worry about it. whatever the definition, it is a
16 bit variable in both cases. I agree that it isn't the best looking
solution, but it should work IF WIN16 has no other impact inside the
wab.h file.
--
Kind regards, Bruno van Dooren bruno_nos_pam_van_dooren#hotmail.com
Remove only "_nos_pam"