从Code :: Blocks运行程序时空白的控制台窗口 [英] Blank Console Window when Running Program from Code::Blocks
问题描述
当我尝试在Code :: Blocks中构建并运行新程序时,控制台窗口弹出空白,我必须单击退出按钮将其停止。对于我尝试过的任何新项目(包括 Hello world),它都会执行此操作。奇怪的是,它对我拥有的任何较旧的项目都正常工作。
When I try to build and run a new program in Code::Blocks, the console window pops up blank and I have to click the exit button to stop it. It does this for any new project I have tried including "Hello world". Oddly it works normally for any older projects that I have.
我在新项目和旧项目中都使用了工具链可执行文件,而且一切都相同。这不是我的代码的问题,因为如果我将其复制并粘贴到旧的项目文件中,它将按预期运行。
I looked in toolchain executables for both my new projects and the old and everything is identical. It's not a problem with my code because if I copy and paste it into an old project file, it runs as it should.
我正在运行Code :: Blocks 13.12在Windows 10上。
I'm running Code::Blocks 13.12 on Windows 10.
谢谢。
推荐答案
您可以测试一下它不在调试时有效吗?通过编译发行版(例如)?
如果它可以在没有调试的情况下工作,我想它可能与调试器或链接器有关。
Could you test if it works when not in debug? By compiling a release (as an example)? If it works without debug, I suppose it could have something to do with the debugger or the linker.
检查链接器语法,以确保它是正确的 -Wl,-启用自动导入
您可以在此处找到这些选项;
Check the linker syntax, to be sure it is -Wl,--enable-auto-import
You can find those options here;
"Settings" -> "Compiler and debugger..."
"Global compiler settings"
"Linker settings"
像 NathanOlivier 说的那样,您应该尝试为Avast的 \Visual Studio 2015\Projects目录添加排除项。
运行我的C ++代码会给我一个空白的控制台(请参见高炉的解决方案)
Like NathanOlivier said, you should try to add an exclusion for your "\Visual Studio 2015\Projects" directory for Avast. Running my C++ code gives me a blank console (See the solution by Blastfurnace)
这篇关于从Code :: Blocks运行程序时空白的控制台窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!