简体   繁体   English

wxPuts 有什么作用?

[英]What does wxPuts do?

I'm trying to learn wxWidgets using this tutorial .我正在尝试使用 本教程学习 wxWidgets。 It directs me to use a function called wxPuts() to put text in the console.它指示我使用名为 wxPuts() 的函数将文本放入控制台。 My program compiles fine, but nothing shows up.我的程序编译得很好,但没有显示任何内容。 I've searched for documentation to see exactly what wxPuts() is supposed to do so that I can get the settings right, but I'm having no luck.我搜索了文档以确切了解 wxPuts() 应该做什么,以便我可以正确设置设置,但我没有运气。 Here is my code:这是我的代码:

#include <cstdlib>

#include <wx\string.h>

int main()
{
    wxPuts(wxT("A wxWidgets console application."));

    return EXIT_SUCCESS;
}

What is wxPuts() supposed to do? wxPuts() 应该做什么? I'm using Code::Blocks, but I also have Eclipse CDT and Microsoft Visual C++.我使用的是 Code::Blocks,但我也有 Eclipse CDT 和 Microsoft Visual C++。 How do I set up my IDE, so that wxPuts() gives the correct output?如何设置我的 IDE,以便 wxPuts() 提供正确的输出?

I had to # include <wx/crt.h>我必须# include <wx/crt.h>

to get wxPuts to work using Code Blocks 17.12, wxWidgets 3.1.2 on Windows 7 Pro.在 Windows 7 Pro 上使用代码块 17.12、wxWidgets 3.1.2 使wxPuts工作。

I received the advice to include crt.h from:我收到了包含 crt.h 的建议:

Why doesn't Clion recognise WxPuts? 为什么 Clion 不识别 WxPuts?

Hope this helps someone else.希望这对其他人有帮助。

I feel kinda dumb.我觉得有点傻It turns out I wasn't waiting long enough for the text to pop up.事实证明,我没有等待足够长的时间来弹出文本。 For some reason it takes a very long time.出于某种原因,这需要很长时间。 My bad.我的错。

This function of wx/string.h library. wx/string.h库的这个函数。 It's show message in console.它在控制台中显示消息。 In order to work correctly.才能正常工作。 This should include some additional information in project properties.这应该包括项目属性中的一些附加信息。 Right Click to Project Properties右键单击项目属性

  1. Built -> C++ Compiler -> in Additional Options add " wx-config --cxxflags " without quotes内置 -> C++ 编译器 -> 在附加选项中添加不带引号的“ wx-config --cxxflags
    1. Built -> Linker -> in Additional Options add " wx-config --libs " without quotes内置 -> 链接器 -> 在附加选项中添加不带引号的“ wx-config --libs

Then it should works fine.那么它应该可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM