![](/img/trans.png)
[英]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.