[英]How can I debug a .exe from the command line with a .exe generated from cl.exe (Visual Studio C/C++ Compiler)?
[英]can run C++ code from command line but not from debug mode in visual studio
我在調試模式下編譯了以下程序,沒有任何錯誤。 我可以從命令行運行.exe文件,但是當我嘗試在Visual Studio中調試代碼時,該行會拋出異常
DetectionInternalSettings* internal_settings =
DetectionInternalSettingsFactory::createFromFileSystem(
"C:/data/card_detection_engine.yaml");
在命令行和調試模式下運行行為不同之前遇到這種情況的任何人。
int main(int argc, char **argv)
{
DetectionSettings settings;
try
{
DetectionInternalSettings* internal_settings =
DetectionInternalSettingsFactory::createFromFileSystem("../data/card_detection_engine.yaml");
}
catch (const MyException &e)
{
fprintf(stderr, "Exception raised: %s\n", e.what().c_str());
return 1;
}
return 0;
}
我還介紹了異常的詳細信息,這里是ocrcarddetectionengine_sample.exe中0x76E1C41F的First-chance異常:Microsoft C ++異常:內存位置0x003FF0D0的YAML :: TypedBadConversion。
與createFromFileSystem
相關的更多代碼
DetectionInternalSettingsFactory::createFromFileSystem(const std::string &configPath) throw (MyException)
{
return new DetectionInternalSettingsImpl(configPath);
}
struct DetectionInternalSettingsImpl : public DetectionInternalSettings {
DetectionInternalSettingsImpl(const std::string &config_path) {
if (config.ReadFromFilesystem(config_path)) {
throw MyException("Bad configuration path.");
}
}
~DetectionInternalSettingsImpl() { }
Core::Detector::Configuration config;
};
信任調試模式異常。 它正在更徹底地測試您的代碼實際上在做什么,而命令行只是在等待問題發生。
在您的情況下,它們似乎沒有發生,可能是因為您沒有對指針變量進行任何操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.