忽略/错过C++断点

Ham*_*sby 1 c++ debugging breakpoints c++builder c++builder-2010

我正在尝试运行一些别人给我的C++代码.起初有一个istream文件链接断开,我通过添加包含路径修复了这个链接:

C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\include\dinkumware
Run Code Online (Sandbox Code Playgroud)

代码现在编译但它不会在任何断点处停止,例如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;
}
Run Code Online (Sandbox Code Playgroud)

它只是打开表单,就像从.exe文件中运行一样,除了它显示

编译MyProject.cbproj(发布配置)....成功

在消息栏中

我尝试从发布模式切换到调试模式,尝试更改输出目录,以便编译新.obj文件.没有成功.

我正在运行Rad studio 2010,它最初写的XE5,但我认为这是文件夹结构而不是IDE版本的问题?

有什么建议?

man*_*lio 5

一些想法(来自不同来源)可能对您有用或可能没有用:

  • 确保你正在使用Debug配置并执行项目的构建,而不仅仅是编译:切换回调试配置并在发布版本不够后进行编译
  • 在Win32(Debug)的项目选项中,确保将以下选项设置为正确的值

    • [C++编译器]→[调试]→[调试信息] = True;
    • [C++编译器]→[调试]→[调试行号信息] = True;
    • [C++编译器]→[优化]→[禁用所有优化] = True;
    • [C++编译器]→[优化]→[生成最快的代码] = False;
    • [C++链接器]→[完全调试信息] = True;
    • [Delphi编译器]→[优化] = False;
    • [Delphi Compiler]→[使用debug .dcus] = True;

    (例如,MDI应用程序的默认配置模板是错误的)

  • 删除所有.pch,.#以及.tds文件,让编译器重新创建
  • 如果您在VirtualBox下运行IDE,请考虑某些版本的断点问题(v4.3.x)

作为最后的手段,你可以尝试{ _asm { int 3 } }模拟一个断点.

另外看看: