Hi I don't really know where to put this but how does one use WxWidgets with c++. I just need to know the syntax or structure of it.

For example:

What would wxwidgets equivalent be for the native code...

#include <iostream>

int main()
    int num1, num2, total;

   std::cout<<"Enter first Number\n";
   std::cout<<"Now enter the second Number to be added\n";

   total = num1 + num2;

   and so on...
   return 0;

How would this fit into a form is what I'm asking?

Thanks in advance :)

wxWidgets is a GUI system. Here is an example: http://www.wxwidgets.org/docs/tutorials/hello.htm

You have to run

wx-config --libs
wx-config --cppflags

to get the settings from your system. Then you have to setup your build. I use cmake, so this is how to do it in cmake:

cmake_minimum_required(VERSION 2.6)


ADD_EXECUTABLE(Basics Basics.cpp )
TARGET_LINK_LIBRARIES(Basics wx_gtk2u_richtext-2.8 wx_gtk2u_aui-2.8 wx_gtk2u_xrc-2.8 wx_gtk2u_qa-2.8 
wx_gtk2u_html-2.8 wx_gtk2u_adv-2.8 wx_gtk2u_core-2.8 wx_baseu_xml-2.8 wx_baseu_net-2.8 wx_baseu-2.8 )

What are you trying to do?


I wanted to take 2 numbers from 2 textfields, add them together and output them in a label just for practice and experimentation. I'm new to GUI programming....

I'm not familiar with wxWidgets, but I suggest you weight your options before diving in. I have chosen Qt. There are other options too, particularly if you're developing for Windows. If you've already chosen wxWidgets, maybe someone else here can help.

I have used wxWidgets before, and my suggestion would be to learn win32 API because it is very similar, also knowledge in win32 will look 10 times better on a resume then wxWidgets. wxWidgets basically copies the syntax and purpose of win32.

LevyDee, but don't forget, you can only use win32 API in Windows!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.