user1133050
user1133050

Reputation: 13

QT: Could not decode "filename.cpp" with"System"-encoding

So i'm working on a personal project using QT 4.7. In the middle of one of my builds, ubuntu 11.10 decided to crash. This version of ubuntu has crashed on me a couple of times in the past, but never has it done so in the middle of a QT- build.

Upon rebooting my system and opening my project in Qt again, I have found that my "mainwindow.cpp" file cannot be decoded, and my mainwindow.ui file "cannot be opened". The rest of my files (main.cpp, and mainwindow.h) are perfectly fine. I also have a couple of other classes that are perfectly in tact.

I have tried all of the different encoding options that QT provides, but none of them work. All I get is a big wash of incomprehensible characters. I go to the command line and I type:

file -i mainwindow.cpp 

and get mainwindow.cpp: application/octet-stream; charset=binary I do the same with mainwindow.ui and I get the same thing mainwindow.ui: application/octet-stream; charset=binary

for more info, the normal .cpp files return this: file -i main.cpp main.cpp: text/x-c; charset=us-ascii

I am assuming this means my files are in binary for some reason and I have no idea how to get them restored. Any help is greatly appreciated!

Upvotes: 1

Views: 2121

Answers (1)

user336063
user336063

Reputation:

Your files were corrupted during the crash.

You may want to look at your .cpp files with a hex editor to see how corrupted it is. If it's only a few bytes (out of ascii range) you could manually fix them. If it's damaged in more than a few places, you may need to start over or use a backup.

Upvotes: 1

Related Questions