Hello,
I have two wxWidget builds on my Ubuntu machine (GTK3 and one for cross compiling for windows). Both work fine which I can test by compiling the examples. How can I set up codeblocks so at least I can have a project that compiles for linux? There is no 'include' directory in my build like you need for setting up codeblocks in the windows tutorial.
Setting up Codeblocks for linux(Ubuntu)
-
- Super wx Problem Solver
- Posts: 466
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: Setting up Codeblocks for linux(Ubuntu)
The easiest way is to just use the new project wizard.
- From the menu, select File->New->Project...
- In the dialog that pops up, select wxWidgets project and then hit the "Go" button
- In the resulting wizard:
- 1st screen (welcome) - just hit next
- 2nd screen (wxWidgets version selection) - just hit next (doesn't matter on linux since wxconfig will be used).
- 3rd screen (project title) enter a project title and folder to store the project in.
- 4th screen (author and info) - enter info info if you want or leave blank.
- 5th screen (gui builder and application type) - for now select either none or wxSmith for builder and frame based for type.
- 6th scren (compiler and configuration) - just hit next
- 7th screen (advanced options) - just hit finish
Incidentally, for the gui builder on the 5th screen, I'm a huge fan of wxFormbuilder, but in the past it's been somewhat difficult to install it on linux. However they just released 3.1.0 which includes a flatpak that seems to work Ok.
Re: Setting up Codeblocks for linux(Ubuntu)
Hello New Pagodi,
it is actually pretty easy to install wxFormBuilder with the deb package but I run into the following problem while using it:
When I set up my wxProject (wxWidgets 3.1, Form Based, GCC) and open the fbp file, the formbuilder says that it removed properties, then after generating the code I cannot build in codeblocks anymore because some message box is not declared anymore (compiles just fine before I open the wxFormBuilder). Do I do something wrong here? I also get the same outcome if I chose Dialogue Based instead.
Edit: I compared the Frame files and in the beginning it says:
it is actually pretty easy to install wxFormBuilder with the deb package but I run into the following problem while using it:
When I set up my wxProject (wxWidgets 3.1, Form Based, GCC) and open the fbp file, the formbuilder says that it removed properties, then after generating the code I cannot build in codeblocks anymore because some message box is not declared anymore (compiles just fine before I open the wxFormBuilder). Do I do something wrong here? I also get the same outcome if I chose Dialogue Based instead.
Edit: I compared the Frame files and in the beginning it says:
while after code generation with wxFormBuilder it saysC++ code generated with wxFormBuilder (version Feb 17 2007)
How can I tell codeblocks to use the newer version for generating the project?C++ code generated with wxFormBuilder (version 3.10.0-4761b0c)
- Attachments
-
- wx1.JPG (19.91 KiB) Viewed 3670 times
-
- wx2.JPG (17.3 KiB) Viewed 3670 times
-
- wxerror.JPG (68.8 KiB) Viewed 3670 times
Last edited by kagi3624 on Thu Sep 30, 2021 7:32 am, edited 1 time in total.
-
- Super wx Problem Solver
- Posts: 466
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: Setting up Codeblocks for linux(Ubuntu)
I don't know how to use clang. Sorry.
To get rid of the complaint about the message box, either just comment out that line or add "#include <wx/msgdlg.h> " to the top of the file. I guess the older version of wxFormbuilder that the codeblocks template is based on would generate files with that include, but not the newer versions don't.
To get rid of the complaint about the message box, either just comment out that line or add "#include <wx/msgdlg.h> " to the top of the file. I guess the older version of wxFormbuilder that the codeblocks template is based on would generate files with that include, but not the newer versions don't.
Re: Setting up Codeblocks for linux(Ubuntu)
Hello, I found the problem. The code::blocks generated project has 3 code files (GUIFrame.cpp, myprApp.cpp, myprMain.cpp) and 3 corresponding header files. In the myprMain.cpp there is a function
which needs
but the updated GUIFrame.h does not include it. In replaces in the GUIFrame.h
with
Sure, I can add the missing header to the main.h and it compiles fine now. But I have still a question now, since code::blocks use sooo outdated files maybe the way the project is set up is outdated too? Is there a tutorial anywhere on how to set up the App.cpp and the main.cpp for 3.1? Thank you!!
Code: Select all
void myprj21Frame::OnAbout(wxCommandEvent &event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("Welcome to..."));
}
Code: Select all
#include <wx/msgdlg.h>
Code: Select all
#ifdef WX_GCH
#include <wx_pch.h>
#else
#include <wx/wx.h>
#endif
#include <wx/menu.h>
Code: Select all
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/menu.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statusbr.h>
#include <wx/frame.h>
Re: Setting up Codeblocks for linux(Ubuntu)
Hi,
What version of C::B do you use?
And I presume you installed it from the repoisitory?
Thank you.
What version of C::B do you use?
And I presume you installed it from the repoisitory?
Thank you.
Re: Setting up Codeblocks for linux(Ubuntu)
That's right. It is 20.03 and it is showing gcc and wxWidget version wrong. I have gcc 11 and
is showing
Code: Select all
wx-config --list
Code: Select all
Default config is gtk3-unicode-static-3.1
- Attachments
-
- cd.jpg (39.93 KiB) Viewed 3590 times