C++断点将被忽略/错过
C++ breakpoints are ignored / missed
我正在尝试运行某人给我的一些C++代码。起初有一个指向istream
文件的链接断开,我通过添加包含路径来修复它:
C:Program Files (x86)EmbarcaderoRAD Studio7.0includedinkumware
代码现在可以编译,但它不会在任何断点处停止,例如formcreate
中的断点:
// Initialise the form and read in the module and inverter names.
void __fastcall TMain::FormCreate(TObject *Sender)
{
ifstream inits;
ifstream inverters;
ifstream modules;
char line[1000];
AnsiString FTO;
inits.open("PVSM.ini", ios::in);
if (inits.is_open())
{
inits.getline(line,1000);
AnsiString parmm(line);
ModDir = parmm.SubString(1,parmm.Pos(" ")-1);
inits.getline(line,1000);
AnsiString parmi(line);
InvDir = parmi.SubString(1,parmi.Pos(" ")-1);
inits.getline(line,1000);
AnsiString parmt(line);
MetDir = parmt.SubString(1,parmt.Pos(" ")-1);
inits.getline(line,1000);
AnsiString parms(line);
ShdDir = parms.SubString(1,parms.Pos(" ")-1);
inits.getline(line,1000);
AnsiString parmx(line);
ExpDir = parmx.SubString(1,parmx.Pos(" ")-1);
}
else // Should never get here, but if ini file missing use defaults
{
ModDir = "C://";
InvDir = "C://";
MetDir = "C://";
ShdDir = "C://";
}
inits.close();
FTO = InvDir + "inverters.data";
inverters.open(FTO.c_str(), ios::in);
if (inverters.is_open())
{
while ( inverters.getline(line,1000) )
{
AnsiString inverter(line);
IVBox->Items->Add(inverter);
}
}
inverters.close();
FTO = ModDir + "modules.data";
modules.open(FTO.c_str(), ios::in);
if (modules.is_open())
{
while ( modules.getline(line,1000) )
{
AnsiString module(line);
ModBox->Items->Add(module);
}
}
modules.close();
CMod = 1;
CStr = 1;
CCell = 1;
nStore = 0;
grid = true;
pasan = false;
debug = false;
calc = false;
cell = false;
module = false;
array1 = false;
inv = false;
PV = true;
Parray = false;
Pcurve = false;
LastType = 'X';
CurrTp = -1; //* Not currently set
AllSame = true;
LdMeteo = false;
mpp = true;
}
它只是打开表单,就好像它是从.exe
文件中运行的一样,除了它显示
编译 MyProject.cbproj (Release configuration)....成功
在消息栏中
我尝试从发布模式切换到调试模式,尝试更改输出目录,以便它编译新的.obj
文件。没有成功。
我正在运行Rad studio 2010
,它最初是用XE5
写的,但我认为这是文件夹结构而不是IDE版本的问题?
有什么建议吗?
一些可能对您有用也可能没有用的想法(来自各种来源):
- 确保使用的是调试配置并执行项目的生成,而不仅仅是编译:切换回调试配置并在发布生成后进行编译是不够的
-
在 Win32(调试)的项目选项中,请确保将以下选项设置为正确的值
- [C++编译器] → [调试] → [调试信息]
= True
;
[C++编译器] → [调试] - → [调试行号信息]
= True
;
[C++编译器] → [优化] - → [禁用所有优化]
= True
;
[C++编译器] → [ - 优化] → [生成尽可能快的代码]
= False
; - [C++链接器] → [完整调试信息]
= True
; - [德尔福编译器] → [优化]
= False
; - [德尔福编译器] → [使用调试.dcus]
= True
;
(例如,MDI 应用程序的默认配置模板错误)
- [C++编译器] → [调试] → [调试信息]
- 删除所有
.pch
、.#
和.tds
文件,让编译器重新创建 - 如果您在 VirtualBox 下运行 IDE,请考虑某些版本存在断点问题 (v4.3.x)
作为最后的手段,您可以尝试{ _asm { int 3 } }
模拟断点。
另请查看:
- 质量中心
- Delphi:为什么不时断点不可用(IDE上的绿色突出显示线)?
相关文章:
- 无法删除指针,已触发断点
- 条件断点在不应该触发时触发
- GDB 断点在 Mac 上是不准确的
- 从 C++ 运行的进程偶尔会错过某个选项
- 在 vscode 中运行时无法暂停或设置断点
- 不会命中此断点
- 当前不会命中断点。没有调试器目标代码类型的可执行代码与此文件关联
- gcc 是否在 2 条短裤的过度对齐结构的比较中错过了优化机会?
- 为什么程序会错过"if"运算符?
- 我的C++合并排序代码不起作用。我在这里错过了什么?
- 如何在进入动态打开的共享库时设置断点?
- 为什么断点显示数组的第二个值是一个大数字?额外学分工作
- 我是否为邪恶刽子手的构造函数错过了什么?
- 代码在 msvcrt .dll函数上设置断点失败
- 在单元测试中,如何在不使用 operator== 的情况下比较两个对象,这可能会错过新成员?
- 如何在引用上设置数据断点
- C++ - 如何不错过来自多个线程的多个通知?
- C++:将向量传递给函数,然后在main中调用函数.错过了什么
- 无法在visual studio 2017(本机c++)中禁用数据断点
- C++断点将被忽略/错过