Project was doing fine, running fine, compiling fine. Until some seemingly random time it stopped being fine.
At the moment I'm getting around 200 stray errors:
./new:4: error: stray '\376' in program
./new:4: error: stray '\377' in program
./new:5: error: stray '\376' in program
./new:5: error: stray '\377' in program
From reading other posts it seems I have some bad characters in my code which I cannot see. So I emptied the whole file I was working on, but no luck. This error persists whatever I do.
Also, when compiling main.cpp (which it does first), it first and foremost includes #include , which is the start of the chain of "from 'file'" messages. This means it didn't really parsed much of main.cpp yet but gets borked from reading internal Qt files?
I'm totally gazing in the dark here, what could this possible be, and how would I resolve this?
Thank you!
I'm using Qt 4.7.2, GCC 4.5.0 and Win7.
Copy your code into notepad and save it. Then remove your main.cpp and add the notepad one to your project. Rebuild and check the result. If it still persists then most probably the problem is not with your source but with the Qt or gcc and/or gnulibc libraries. They probably got corrupted or are stored in a different, unsupported encoding.
Octal \376 \377 is 0xFEFF, which is the Unicode Byte-Order Mark. It is used to signal the endianness of a UTF-16 text file, and also to signal that a file is UTF-8-encoded. It should only occur at the start of a file, but it seems to have crept into the header comments in your library header file new, at lines 4 and 5. Locate this file, and delete those lines. (But only if they're comments!)
to me things like these happend in the past when I copied source from some web page. Only typing it again solved the issue. But maybe some tool to convert the encoding might fix the issue as well.
Your source file is probably encoded in UTF-16 or something like that.
Try copy-pasting the code in a new file and see if that helps.
A conflict might exist. For example, I created a project named QTcpServer.pro, but when I tried to #include QTcpServer, I got many stray errors. Renaming my project (QTcpSvr.pro) solved this error.
Related
I've recently set up WP coding standards in VSCode by following https://www.edmundcwm.com/setting-up-wordpress-coding-standards-in-vs-code/.
With this setup files aren't getting saved and shows this message at the bottom right:
Saving ‘plugin.php’: Running ‘phpcbf’ Formatter (configure).
The only way to save is to press Cancel when this appears.
Any idea?
Please use which phpcs & which phpcbf to find the paths.
which phpcs
e.g. "C:\Users{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcs
which phpcbf
e.g. C:\Users{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcbf
once you find the paths to the executables, open your vscode json settings and add double check that the executable settings for phpcs & phpcbf match the paths.
Examples:
"phpcs.executablePath": "C:\Users\{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcs.bat",
"phpcbf.executablePath": "C:\Users\{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcbf.bat",
I think this issue is pretty widespread despite the lack of answers in this thread. Setting the paths as above does not fix things. For me, this happens when saving a file and there is nothing for the formatter to fix.
There is an open pull request for this issue that has been open for over a year now.
A fork of the project has popped up that specifically fixes this issue. Look for phpcbf in VSCode and find the one by Simone Baldini.
Try installing that to see if it resolves the problem.
I am working on an ASP.Net MVC5 project and using vimdiff as my mergetool.
I am getting a merge conflict on a .csproj. This is not unexpected as files get added in different branches all of the time, however it seems that the process of merging is adding some junk data?
This is the state of the csproj on local, base and remote:
And this is the apparent merge conflict:
As far as git is concerned the whole file is now a conflict...
<<<<<< HEAD
WHOLE CS PROJ FILE WITH CHARACTERS AT START
======
WHOLE CS PROJ FILE WITHOUT CHARACTERS AT START
>>>>>> develop
This obviously makes performing a proper merge kind of difficult.
I cannot see these characters in either branch before I try the merge.
Any ideas?
This is an UTF-8 BOM, indicating that the file is encoded as UTF-8. It is only recognised at the start of a file, and since <<<<<< HEAD has been inserted before it, it is no longer at the start of the file, and has been made visible by a tool that does not detect / no longer detects the file as UTF-8.
Ensure that all tools you use to modify the file agree on whether the BOM should be there. If they all agree, then it should never cause a conflict. If some add the BOM when it isn't present, and others remove the BOM when it is present, conflicts are unavoidable.
You just remove the lines you would not see in your source. git add the file(s) and make a commit, so you resolved a conflict.
In writing a Qt4 app, I clumsily wrote:
QObject::connect(spinbox, SIGNAL(vlaueChanged(int)), ....
and it compiled, and it ran, but of course the spinbox didn't have any effect.
Such misspellings should be caught. I always assumed that valueChanged() was declared in some header file, but apparently not. Any arbitrary garbage can be given to SIGNAL() or SLOT(), and it'll compile. My toy program is small. For a huge app with dynamically created controls connected on the fly, an error like this could be very hard to track down.
Is there some way to do error checking for this kind of typo? Is it possible for the compiler (gcc) to do this, or is some other tool appropriate?
This has been changed for Qt5. You can read about it here.
SIGNAL and SLOT macros turn their arguments into strings, and they are not checked in compile time (because... they are string actually). In case of wrong signal/slot name Qt writes warning (qWarn) in runtime. They say, in Qt5 something changed there.
In my experience, sometimes you really can do such a mistake (though rarely, autocompletion helps a lot), but it can be easily tracked down and fixed.
I'm doing development for Blackberry 10 using Cascades, which includes QT and QML. I find that I sometimes make mistakes in my QML file, but they don't get picked up at compilation time. How can I check whether I've made a syntax error, or mis-named a function call, or other typical errors?
QML is a dynamic language that is evaluated at Runtime. There is no compilation step and due to the nature of javascript and the dynamic nature of the global context there is no way for it to tell if what you are writing is correct/incorrect until it is evaluated. QtCreator can help with some of the QML errors you will find, but there is unfortunately no good way to get syntax errors about your javascript until it is evaluated and it explodes.
Personally, I have found good usage of the debugger to be the key to making these sort of fixes easy.
tldr; Keep your javascript clean and to a minimum there is no compile time checking.
open terminal in IDE connect your device or emulator using blackberry-SSH after connecting enter slog2info it show syntax and all typical error JavaScript with description and line NO.
If there are any mistakes it will show those lines in RED marks. It is dynamically checks there is no need to worry about compile.
If you done wrong you will not see the DESIGN CONSOLE correctly.
I notice several other people have had similar problems, however this is a bit strange...
I have a new install of scode 4.2 and the most recent cocos2d from a few weeks back. I have changed all files that include Box2D to the C++ .mm file extension. I have also set a user header search path for appName/libs**.
When I compile either b2BroadPhase.cpp and/or b2CollideCircle.cpp are missing, or even more rare, Box2d.h is missing. I have checked and all of these files are in the correct location in my applications directory.
Can anyone tell me why the files are not being found and why the number of files missing is randomly fluctuating?
EDIT:
Ok, so I obviously don't understand Header Search Paths... Are they designed to point towards folders that wouldn't normally be searched? If I add a Header Search Path then I get 200+ errors saying box2D files cannot be found. If I don't add a header search path I get 1-3 errors saying files cannot be found.
Your issue is that you have set the "User Header Search Path". However, Box2D requires you to specify the path in the "Header Search Path" build setting. This is because Box2D is using C++ style angle bracket include statements:
#include <Box2D/Dynamics/b2Body.h>
If that should not solve the (or all of the) problem(s), check this:
If you assume the same Box2D path as it is in cocos2d-iphone:
cocos2d-iphone/external/Box2d/Box2D
Then your Box2D Header Search Path must point to
cocos2d-iphone/external/Box2d/Box2D
You may have specified the "Box2d" folder instead of the "Box2d/Box2D" folder. That is also a common mistake.
Your header search paths are most likely wrong. Would you mind posting what it is?
If your Box2D folder is in your Xcode folder (look in finder), it should be as simple as this:
$(SRCROOT)
or
$(SRCROOT)/Box2D
My problem was that I was having an #import "Box2D.h" statement on a file with a ".m" extension instead of ".mm" .. Changing the file extension (select file, press enter, add extra "m") got rid of all the box2d errors.
Hopefully this helps someone else!