My project works fine in Xcode 8. When I build It in Xcode 9, there are many C++ semantic issues reported.It seems Xcode 9 C++ complier do much stricter type checking than Xcode 8.Is there a build configure fix to this.
There are three little lines in the upper right of the error list. Like an icon of lines of text. Click those to get the raw compiler output for your error messages. At the end of each warning it usually names the command-line flag corresponding to it (like [-Wwarn-about-mistakes]). You can search for that in build settings using the filter field to see the corresponding check box.
All that said: all these warnings have a reason for being there. You should find out what each warning is about and change your code the right way so the compiler doesn't have to warn anymore.
Even if these warnings seem pointless and your code appears to work, they usually indicate an issue that is either already occurring, or might have unexpected side effects later when you change another part of your code.
Related
There is an option to disable fuzzy ("spellcheck-like") IntelliSense matching for member lists but not for everything else. It is ridiculous that I type "d3dev" and the first suggestion is D3D_CBF_FORCE_DWORD instead of ID3D11Device. If I try "id3dev" I get ID3DInclude for god knows what reason. C++ IntelliSense is just flat-out unusable for me and, as much as I hate to say it, MonoDevelop's autocompletion is leagues beyond what Microsoft has to offer.
In MonoDevelop, I can just type the first letter of each word (urd -> UnityRenderDevice, for example) and it pops right up. In VS, I type urd and it gives me UriBuilder_USE_ORIGINAL_FLAGS for pity's sake.
Please help me fix this thing. VS is my only option for C++ on Windows and I am so actively not wanting to even open the program anymore due to frustration.
Intellisense should work in the way you described it, so there must be some sort error within your VS installation. Try a clean reinstall .
I have an Xcode project that will not display C++ std::strings when I am debugging. It's incredibly frustrating because I am having to resort to print statements or outputting each character one at a time in the LLDB console window, which is time consuming and hard to read.
Every other person using this same project is having the same problem, and other projects are not seeing this problem, so I would think that this is a project setting of some kind. I'm in debug and there are no optimizations turned on, so I've eliminated that as the issue. I've also compared project settings between working projects and the one with this problem and they appear identical in every way that they can be.
Here's a sample of the output I get, *_M_p in this example is correct, the first character of the string is a question mark:
And here's what I get in the debug console if I inspect the string one character at a time:
I've heard that switching back to GDB from LLVM might solve the problem, but GDB gave me other issues with debugging certain data types, so I'll just have new problems in that case.
My co-worker figured out the fix for this: Turn off the Guard Malloc option in the scheme settings.
Click the scheme that is exhibiting the problem
Click on Edit Scheme
Click on Diagnostics
Uncheck the 'Enable Guard Malloc' option.
Now std::strings should be showing up. We don't know why this is the case, it may be a bug in Xcode, but I would think it would've been spotted awhile ago. Also, this was tested on multiple projects and enabling Guard Malloc always causes std::strings to not show up properly in debugger.
Try this lldb command
exp -f s -- myString
You are telling the lldb to show the expression of your string with the format c String
This might not have caused the original poster's problem, but it caused mine: I was using Xcode 6.4 while most of the code had been built with 6.2. Switching to 6.2 made the values visible in the debugger.
Try this command
po string_name
I am using PC-Lint for my C++ project.
Is there a way to switch off all error and warning messages by default, so I can then reintroduce the required messages explicitly?
I have read the chapter of the PC-Lint manual entitled "Error Inhibition Options" and the best I could find was setting the wLevel to -w0 No messages (except for fatal errors)
Yes, it is possible, you can simply use -e* or -w0. However, the manual truly states (Chapter 16. Living with Lint):
DO NOT simply suppress all warnings with something
like: -e* or -w0 as this can disguise hard errors and make subsequent diagnosis very difficult.
So, yes, you can use it if your code is basically cleaned, and you want to review recent changes for a certain set of messages. But if you want to start cleaning your code, and are swamped with messages because of the default warning level -w3, I suggest to start using -w1, and resolve all issues there; most of the warnings/errors given at level one indicate problems with finding all header files, having al implicit macros set properly, and/or mimicking the compiler you use normally in a sufficiently precise way.
As always, I hesitate to advertise my own work, but if you want, take a look at my "How to wield PC Lint" PDF, where I have documented detailed instructions to handle the initial deployment of PC Lint and tackling the many warnings/errors/infos/notes you may be buried under.
When I started introducing PC-Lint to a new project I did the following:
As suggested by Johan Bezem, ran a -w1 level check over the whole thing. This doesn't actually find any new problems, but checks that your program is syntactically valid and finds any configuration issues. Nothing major, assuming your project compiles already.
Run the test again with -w2 level. This found 53,000 issues, which was a bit much to tackle in one go.
Pick a typical bad file, then suppress any errors that seem
irrelevant or non-urgent (eg. error 525: (Warning -- Negative indentation from line xxx)
adding -e525 to the command line or config file, until you find one that seems serious.
In my case this was
error 442: (Warning -- for clause irregularity: testing direction inconsistent with increment direction), i.e. a 'for' loop
that looked like it should be counting up was actually counting
down.
Reset the test level back to -w1 but added in the critical problem by number, -w1 +e442 in this case. Re-run it over the whole project then fix all the instances of that problem.
Back to stage 2 and try again.
This combination of fixing actual problems and suppressing likely false alarms soon gets your numbers under control.
So that everything gets better over time we also implement a script that does a thorough (full -w2 or -w3) check on any files that are created or modified.
I also found the tool LintProject very helpful as it can do an entire Visual Studio solution in one go, with tables with numbers of errors and worst offenders!
I am working on a rather large project, and I am having strange problems with the IDE in terms of error checking and somewhat with IntelliSense.
Usually if I were to type something boneheaded, like "int a = "aa";", it would underline "aa" in red. However I am seeing VS do this to random parts of my code when I make insignificant changes.
For example:
/*
Some comment here, just going to stretch it out for my example..
*/
int proto1();
int proto2();
If I make changes to other parts of the project, sometimes random functions will get underlined, and even part of a comment. Like just 30 minutes ago it underlined the equivalent of half of that comment beginning in the middle of the word "comment", also it underlined all of int proto1(); and part of int proto2();
I would post screenshots but I am bound by contract not to disclose any work, and I can't easily replicate it in smaller projects.
I don't understand why it does this. When I compile the project, any fake errors and underlining it did goes away and it compiles fine. The point though, is there are no errors. It's making up random errors and underlining random lines/words/half words. I would also like to note that there seems to be a large delay in loading new intellisense information, almost by 2-3 minutes or longer.
I'll try and reproduce it in an unrelated project and post here if I can. However, any help would be appreciated.
Thanks!
*Edit: Forgot to note that hitting the space key several times will on occasion correct the errors however this isn't reliable and does not always work.
Intellisense sometimes can really get stuck with complicated code. I guess until VS2012 release comes out, there's nothing we can do.
There's however one trick that I'm using if this happens - switch your build configuration Debug -> Release and then back again. You don't have to wait, you can just click two times on this drop-down box. It should refresh IS cache and make red error underlines dissappear.
Intellisense is often off, but make sure you have latest updates installed.
I just installed sp1 yesterday and lot of Intellisense issues went way.
I see this is a stale question but some may find this helpful.
I just had this same issue. I tried many of the solutions outlined here and elsewhere. I finally tried running Visual Studio as another user (Shift Right Click Run As Different User) and the issue did not present. I then logged into my computer as another user and deleted the profile of the user I was having the issue with.
If your profile is important to you or there is information within it that is important I highly recommend backing up relevant information first. If you don't understand what information you profile contains make sure you do prior to deleting it.
1) Log in as different user (with admin privileges) than you want to delete
2) Open Properties for Computer
3) Advanced system settings (on the left side)
4) Settings for User Profiles (in the middle)
5) Select the profile you want to delete and click the delete button
6) Reboot
Credit to:
https://superuser.com/questions/63017/how-do-i-delete-a-user-profile-on-a-windows-7-machine-that-is-part-of-a-domain
I had the same issue, and in my case it was mostly related to library functions and types defined in libraries. This one fixed it for me:
Open command line parameters. You can use following to reach there:
Project > ProjectName Properties > Configuration Properties > Linker > Command Line
In the Additional Options box at the bottom add
/I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
You will of course need the correct path where Visual Studio is installed.
Bingo! I hope it works for you too. :)
I have a Managed C++ WinForm that suddenly stopped showing in the VS 2005 designer. The error it shows is
Could not find type 'int'. Please
make sure that the assembly that
contains this type is referenced. If
this type is a part of your
development project, make sure that
the project has been successfully
built.
I don't even know where to start with this one. Does the designer only access the InitializeComponent(void) method when rendering the form? So my question is: where do you start troubleshooting designer errors?
EDIT: I forgot to mention that this code builds and runs perfectly. It only shows an error in the windows forms designer.
This is troubleshooting for C# but I'd assume a couple of the points mentioned here would help.
What's the state of play with "Visual Inheritance"
This is usually caused by a syntax error somewhere in the code that causes the designer to be unable to run the form to render it. The best method for this is ofent sadly just reading the code looking for the problem extra brace, missing string etc. The good news is that it is most likely easy to find since you know that it preceeds the INT in the error message.
Some possibilities:
* I cause this usually by accidentally hitting the keybaord and putting some extra characters at the top of a file
* Extra braces that make the class uncompilable - missing quotes, semicolons
* Something typed at the top that messes up a common include/using statement
Diagnostics
* Sometimes you can find this by dogin a build and seeing what lione is flagged with an error and then looking around it.
* More often then not I have to just open the source file and scan through it looking for the problem.