Eva
Eva

Reputation: 4730

What does wxPuts do?

I'm trying to learn wxWidgets using this tutorial. It directs me to use a function called wxPuts() to put text in the console. 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. 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? I'm using Code::Blocks, but I also have Eclipse CDT and Microsoft Visual C++. How do I set up my IDE, so that wxPuts() gives the correct output?

Upvotes: 1

Views: 1526

Answers (3)

Ken_sf
Ken_sf

Reputation: 119

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

to get wxPuts to work using Code Blocks 17.12, wxWidgets 3.1.2 on Windows 7 Pro.

I received the advice to include crt.h from:

Why doesn't Clion recognise WxPuts?

Hope this helps someone else.

Upvotes: 4

Jasurbek Nabijonov
Jasurbek Nabijonov

Reputation: 1745

This function of wx/string.h library. 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
    1. Built -> Linker -> in Additional Options add "wx-config --libs" without quotes

Then it should works fine.

Upvotes: 0

Eva
Eva

Reputation: 4730

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.

Upvotes: 1

Related Questions