Author Topic: Compile a hello world project  (Read 9927 times)

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Compile a hello world project
« on: April 24, 2010, 02:05:15 pm »
Hello, I am a newbie using codeblocks (with the compiler integrated).
I'd like to build and run an easy program.
Here how I proceed:

File -> New -> wxWidget Project.

Preferred GUI Builder :  None
Application Type : Frame Based
wxwidgets : C:\wxWidgets-2.8.10
Compiler : GNU GCC Compiler
Create "Debug" configuration
Create "Release" configuration

Then I have two warnings windows "a matching debug configuration cannot be found in the wxwidget directory you specified"
"a matching release configuration cannot be found in the wxwidget directory you specified"
Then when I do Build .
Nothing appears.
I think I lost the log window and I cannot get it back.
How can I do that?

Please help

Here is my code:
Code: [Select]
#include "NewPanel.h"

//(*InternalHeaders(NewPanel)
#include <wx/intl.h>
#include <wx/string.h>
//*)

//(*IdInit(NewPanel)
const long NewPanel::ID_BUTTON1 = wxNewId();
//*)

BEGIN_EVENT_TABLE(NewPanel,wxPanel)
//(*EventTable(NewPanel)
//*)
END_EVENT_TABLE()

NewPanel::NewPanel(wxWindow* parent,wxWindowID id)
{
//(*Initialize(NewPanel)
Create(parent, id, wxDefaultPosition, wxSize(949,283), wxTAB_TRAVERSAL, _T("id"));
Button1 = new wxButton(this, ID_BUTTON1, _("Label"), wxPoint(144,48), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
//*)
}

NewPanel::~NewPanel()
{
//(*Destroy(NewPanel)
//*)
}


void NewPanel::OnButton1Click(wxCommandEvent& event)
{
}

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Compile a hello world project
« Reply #1 on: April 24, 2010, 02:20:27 pm »
It looks like you are missing wxWidgets.
You have to download the sources and build it yourself or use the devpak-version.

How to install wxWdgets and set up C::B for use with it see this wiki-article: http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Compile a hello world project
« Reply #2 on: April 24, 2010, 05:49:05 pm »
I had installed wxwidget 2.8.10 ... only binaries, is that enough?

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Compile a hello world project
« Reply #3 on: April 25, 2010, 04:12:53 am »
I had installed wxwidget 2.8.10 ... only binaries, is that enough?

You have to have the debug and release versions of the libraries, and you have to tell codeblocks where they are. The easiest way to do this is to set the wx environment variable to point to the directory you had it installed. And you have to have the headers as well.

HTH,
Ken

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Compile a hello world project
« Reply #4 on: April 25, 2010, 09:32:20 am »
thank you but I really cannot find the debug and release version !
When I download the wxAll from here
http://www.wxwidgets.org/downloads/

I don't have any debug nor release folder into the archive so when I create a new project I cannot specify Debug nor Release...
I am so lost.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Compile a hello world project
« Reply #5 on: April 25, 2010, 10:23:33 am »
thank you but I really cannot find the debug and release version !
When I download the wxAll from here
http://www.wxwidgets.org/downloads/

I don't have any debug nor release folder into the archive so when I create a new project I cannot specify Debug nor Release...
I am so lost.
It looks like you are missing wxWidgets.
You have to download the sources and build it yourself or use the devpak-version.

How to install wxWdgets and set up C::B for use with it see this wiki-article: http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef

Please read the link I posted and follow the instructions, or nobody can help you.

And also read carefully what the wxWidgets-team writes on their download-page: the listpoint Source Archives (where you find the windows-installer) means that they provide source archives and not prebuild binaries for windows !

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Compile a hello world project
« Reply #6 on: April 25, 2010, 11:15:43 am »
I followed the tutorial on your link with the compilation or all sources :
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1

It ends and when I create a new code blocks project, I still cannot make work the debug or release option while I had written down the right path to the wx widget path.
It says " a matching  release configuration cannot be found ..."
Do you have any idea why?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Compile a hello world project
« Reply #7 on: April 25, 2010, 01:40:41 pm »
Please check if your global variable ($(#wx))  is set correctly : http://wiki.codeblocks.org/index.php?title=Global_compiler_variables

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Compile a hello world project
« Reply #8 on: April 25, 2010, 02:22:27 pm »
Yes and I did not use the variable but I wrote down directly the path C:\wxWidgets.
I still have the same issues :(

http://yfrog.com/5n55001653j
http://yfrog.com/5dll2mj

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6996
    • My Best Post
Re: Compile a hello world project
« Reply #9 on: April 25, 2010, 11:52:06 pm »
I suggest compiling wxWidgets with Debug build option if you wish to use the debug version of wxWidgets!

http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#BUILD

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Compile a hello world project
« Reply #10 on: April 26, 2010, 10:15:49 pm »
I am sorry but I may miss something right here?
I compile wxwidget using the build = debug .
Indeed, it produces as the documentation says this:

A release build of wxWidgets creates libraries without the "d" suffix -- for example, "libwxmsw28.a"/"wxmsw28_gcc_custom.dll".
A release build of wxWidgets creates the folder "msw" or "mswu" in the wxWidgets library output folder.

But when I do create a new wxwidget project under code blocks, I cannot select any configuration among Debug or Release despite the fact I did correctly compile wxwidget.

Here is the problem http://yfrog.com/5n55001653j
Whatever the configuration I select, it says then "cannot be found"
Thank you for help.



Offline stahta01

  • Lives here!
  • ****
  • Posts: 6996
    • My Best Post
Re: Compile a hello world project
« Reply #11 on: April 26, 2010, 11:18:13 pm »
You are doing something wrong or you found a bug; but without the steps you followed no one can confirm if it is a bug or not.

Minor things to check include:
   Does setup.h exists in the proper location under your wxWidgets sub-folder?

IIRC,  the location is about "C:\wxWidgets\Lib\gcc_dll\wx\msw???\setup.h
Where ??? is set by debug/release and ANSI/Unicode options.

  Does the wxWidgets DLLs exists?

What type of wxWidgets are you trying to use? Unicode/ANSI, Release/Debug, MultiLib/Monolithic

Tim S.
« Last Edit: April 26, 2010, 11:41:18 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Compile a hello world project
« Reply #12 on: April 27, 2010, 06:46:26 pm »
Yes the setup.h is present several times under the wxwidgets folder like :

Here:  C:\wxWidgets\lib\gcc_dll\mswu\wx
And
Here: C:\wxWidgets\lib\gcc_dll\mswud\wx

Indeed I launched the two commands

mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1
mingw32-make -f makefile.gcc BUILD=debug SHARED=1 MONOLITHIC=1 UNICODE=1

I have also :
wxmsw28u_gcc_custom.dll
and
wxmsw28ud_gcc_custom.dll

And here is how I proceed to create a wxwidget project under code blocks:
File -> New -> WxWidget
Please make a selection wxwidget 2.8.x
Project title : testremi
Author : Empty
Preferred GUI Builder: None
Application Type: Frame Based
wxwidget locations : C:\wxWidgets
Compiler : GNU GCC Compiler
Create Release configuration (checked) : Release
Release option :bin\Release\
Objects output dir : obj\Release\
Next Page nothing checked
Next => Warning 

" A matching Release Configuration cannot be found ..."
...
So I cannot build anything .
Is that a bug?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Compile a hello world project
« Reply #13 on: April 27, 2010, 08:07:45 pm »
Check the oprojects build-options (compiler searchpath, linker searchpath).
Turn on full compiler logging and see what is really sent to compiler/linker (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6996
    • My Best Post
Re: Compile a hello world project
« Reply #14 on: April 27, 2010, 09:31:05 pm »
You still have NOT stated if you are picking the Unicode DLL build during the Code::Blocks Wizard.

Note: The settings may be under advanced options in wizard.

Edit: Please try Checking the correct wxWidgets Library Settings
use wxWidgets DLL
wxWidgets is an Monolithic build
enable unicode

Tim S.
« Last Edit: April 27, 2010, 09:44:24 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cotede2

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Compile a hello world project
« Reply #15 on: April 28, 2010, 06:53:24 pm »
thank you.
Clicking all use wxwidget dll, unicode and the other item , it does not display any error message.
Thanks all