linux编译不小心 覆盖了源文件怎么办?(linux高手进)

例如:gcc a.cpp -o a.cpp
2025-03-01 16:13:33
推荐回答(5个)
回答1:

只能是恢复硬盘了:
只是不知道这个和用rm清除的数据情况是否一致,应该可以试试:
linux ext3 ext4文件系统下 恢复 rm -rf 误删除文件:http://qyiyunso.blog.163.com/blog/static/350776862010826115537113/
我的测试:
gcc sayHello.cc -o sayHello.cc
/tmp/ccmJYL0I.o: In function `main':
sayHello.cc:(.text+0x14): undefined reference to `std::cout'
sayHello.cc:(.text+0x19): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)'
/tmp/ccmJYL0I.o: In function `__static_initialization_and_destruction_0(int, int)':
sayHello.cc:(.text+0x41): undefined reference to `std::ios_base::Init::Init()'
sayHello.cc:(.text+0x46): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccmJYL0I.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

回答2:

可以尝试mc或者debugfs 但是估计回复率不大。除此外,也没什么好的办法。

可以hi我。但我不保证完全可以回复哈。只是告诉你怎么回复而已。

回答3:

试试数据恢复软件吧,至少能恢复一部分

回答4:

先备份一个啊!

回答5:

重写吧