VC++ now give me C2371 redefiniton error but it doesn't show me two definitions.
It just show me one! I want to see other definition too.
Is there a way to see both definitions?
For some reason Visual Studio doesn't show secondary info lines in the Error List view, which is available from the actual compiler output. Try double clicking the error in the "Error List" view, then switch to "Output" view and the corresponding output line should be highlighted. Here, in the output, you should see a second line saying "something.something.h(123) : see declaration of 'foo'". Double click that line and you'll end up at the first declaration.
Related
By default Android Studio shows compiler errors by a red, horizontal line on the right side of the code editor. Is there any plugin to show it in the left side (where the line numbers are) or even better at the bottom in a separate view like in Visual Studio and all the other IDEs?
There is one plugin that shows you errors in the left side, Error item line marker from Chris Gamache , but I didnt find one plugin to show you errors at terminal like VS.
Android studio marks warnings in Java code, some of them I consider useless and want to disable them.
I know I can configure Inspections that are enabled, but for some of these I can't find where it can be disabled. Then code is marked to have issues, and I want to have clean code so that I see real problems.
Example of warning:
'if' statement can be replaced with 'return ...'
And I don't want to put annotations to my code, rather I'd like to switch this off in IDE.
Thanks
When you click on the lightbulb and then on the suggested action's arrow, you get submenu with options. First one should be "Edit inspection profile setting", which should navigate you to the exact place in Settings, where you can edit given inspection.
This is a more general answer for future viewers. These are various ways to suppress the warning.
Statement
Add the following comment above the line with the if statement.
//noinspection SimplifiableIfStatement
if (...)
Method
Add the following line at the beginning of the method.
#SuppressWarnings("SimplifiableIfStatement")
private boolean myIfMethod() {
if (...) return false;
return (...);
}
Class
Add the following line at the beginning of the class.
#SuppressWarnings("SimplifiableIfStatement")
public class MyClass { ... }
Current project
Position your cursor on the if statement and press Alt + Enter. Then choose Simplify > Disable inspection.
All projects
Position your cursor on the if statement and press Alt + Enter. Then choose
Reapplying the inspection
If you disabled the inspection by mistake, you can turn it on again.
Go to File > Settings > Editor > Inspections > J2ME issues
Check the line for "if statement may be replaced with && or || expression"
Notes
The inspection is there for a purpose. It would generally be better to follow the warnings advice and just simplify the if statement. (However, sometimes I find the "simplification" harder to read. Thus my answer here.)
You don't really need answers like this. You can autogenerate the suppression code for any warning by clicking on the code with the warning and pressing Alt + Enter and then expanding the options the lightbulb. You will be given options to suppress the warning for the statement, method, class, etc.
Settings -> Editor -> Inspections -> Java -> Control flow issues -> Redundant 'if' statement
You can type "if statement" in the search box to highlight all inspections involving if.
In Android Studio 3.4.1 at least, if you right click on the Analysis marker at top right of the code pane you can change the level of highlighting there. I've set my level to 'Syntax only'.
Frequently when entering code I will type half of a line, for example the opening part of an if statement, but rather than type the second half I will want to copy and paste, both for convenience and to minimize the chance of a typing error. However if I move the focus away from a half completed statement I get the very annoying "compile error, expected end of statement" pop up which I must acknowledge. This is becoming very tedious when it comes up so often.
Is there any way to tell excel not to show this error message?
Annoying isn't it? Click Tools -> Options -> Editor Tab and uncheck Auto syntax check
When I press F7 in MSVC++ 2010 and the build returns errors, the process stays on the output window.
Is there an option to make it go to the Error List instead after building?
In the Options dialog, navigate in the left tree to Projects and Solutions > General. There, you will find a check box named Always show Error List if build finishes with errors.
Check that box.
is there a way in visual studio to select some type and display how it gets included into the current file?
for example i'd like to click on some membervariable
SomeType a;
and then get displayed something like "first_include.h"->"second_include.h"->"SomeType.h"
to understand what chain of includes the compiler uses to take the declaration of the variable SomeType.
Thanks!
Try the "show includes" option in C/C++->"Advanced Project Settings".
EDIT:
"Show includes" will display all the files that are includes from a particular file. Include files shown will be indented according to the level at which they are included. Use "go to definition" to find which file has the definition and then simply look for the hierarchy of includes which leads to that file.