API: Trying to Install Libraries...

Pages: 123
The terminal you use to compile needs to know where to find the compiler and other tools. You need to either add mingw to the PATH or open the script they (nuwen) provides. To add it to the PATH run the set_distro_path.bat script in the mingw directory, or just open open_distro_window.bat which sets all the variables temporarily for the terminal window. Also, as modoran pointed out you will need to remove MSYS (you shouldn't need it with nuwen anyway)
Thanks, I really appreciate the guidance.

Also, does wxFormBuilder create resource/header files like resedit, or does it do some other stuff as well?
Last edited on
ok, I built the library:

(mod: no unicode)
mingw32-make -f makefile.gcc SHARED=1 UNICODE=0 BUILD=release clean
mingw32-make -f makefile.gcc SHARED=1 UNICODE=0 BUILD=release


And it went down fine.

But, when I tried to run a test program, it would not compile. I rebuilt the library:

(mod: no unicode, no shared)
mingw32-make -f makefile.gcc SHARED=0 UNICODE=0 BUILD=release clean
mingw32-make -f makefile.gcc SHARED=0 UNICODE=0 BUILD=release


And it still wont compile.


This is the error I get (for all of the builds...). I folled the directions for the setup on
http://wiki.wxwidgets.org/Compiling_using_Netbeans
and, it got me further.

Here's the deal though: there really is NO setup.h under the include directory. There are, however, two files:

setup_inc.h (40kb)
setup_redirect.h (1kb)

I renamed both (1 at a time, renaming them their origional names afterwards) to setup.h, but only to get a plethora of new errors about other missing files that "don't exist".

Here is the error that tells me setup.h does not exist:
In file included from c:/wxWidgets/include/wx/defs.h:21:0,
                 from c:/wxWidgets/include/wx/wx.h:15,
                 from main.cpp:2:
c:/wxWidgets/include/wx/platform.h:196:22: fatal error: wx/setup.h: No such file or directory
 #include "wx/setup.h"
                      ^
compilation terminated.


Here is the error I get when I rename either of the two (seemingly) related files:

In file included from c:/wxWidgets/include/wx/platform.h:293:0,
                 from c:/wxWidgets/include/wx/defs.h:21,
                 from c:/wxWidgets/include/wx/wx.h:15,
                 from main.cpp:2:
c:/wxWidgets/include/wx/chkconf.h:1817:9: error: #error "wxClipboard requires wxDataObject"
 #       error "wxClipboard requires wxDataObject"
         ^
In file included from c:/wxWidgets/include/wx/wx.h:15:0,
                 from main.cpp:2:
c:/wxWidgets/include/wx/defs.h:2887:5: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
     "/manifestdependency:\"type='win32'         \
     ^
c:/wxWidgets/include/wx/buffer.h: In constructor 'wxCharBuffer::wxCharBuffer(const char*)':
In file included from c:/wxWidgets/include/wx/string.h:55:0,
                 from c:/wxWidgets/include/wx/memory.h:16,
                 from c:/wxWidgets/include/wx/object.h:20,
                 from c:/wxWidgets/include/wx/wx.h:16,
                 from main.cpp:2:
c:/wxWidgets/include/wx/buffer.h:29:37: error: 'strdup' was not declared in this scope
         : m_str(str ? strdupfunc(str) : NULL)                               \
                                     ^
c:/wxWidgets/include/wx/buffer.h:127:1: note: in expansion of macro 'DEFINE_BUFFER'
 DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
 ^
c:/wxWidgets/include/wx/buffer.h: In member function 'wxCharBuffer& wxCharBuffer::operator=(const char*)':
c:/wxWidgets/include/wx/buffer.h:81:37: error: 'strdup' was not declared in this scope
         m_str = str ? strdupfunc(str) : NULL;                               \
                                     ^
c:/wxWidgets/include/wx/buffer.h:127:1: note: in expansion of macro 'DEFINE_BUFFER'
 DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
 ^
c:/wxWidgets/include/wx/buffer.h: In constructor 'wxWCharBuffer::wxWCharBuffer(const wchar_t*)':
c:/wxWidgets/include/wx/buffer.h:29:37: error: '_wcsdup' was not declared in this scope
         : m_str(str ? strdupfunc(str) : NULL)                               \
                                     ^
c:/wxWidgets/include/wx/buffer.h:134:1: note: in expansion of macro 'DEFINE_BUFFER'
 DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW);
 ^
c:/wxWidgets/include/wx/buffer.h: In member function 'wxWCharBuffer& wxWCharBuffer::operator=(const wchar_t*)':
c:/wxWidgets/include/wx/buffer.h:81:37: error: '_wcsdup' was not declared in this scope
         m_str = str ? strdupfunc(str) : NULL;                               \
                                     ^
c:/wxWidgets/include/wx/buffer.h:134:1: note: in expansion of macro 'DEFINE_BUFFER'
 DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW);
 ^
c:/wxWidgets/include/wx/string.h: In function 'int Stricmp(const char*, const char*)':
In file included from c:/wxWidgets/include/wx/memory.h:16:0,
                 from c:/wxWidgets/include/wx/object.h:20,
                 from c:/wxWidgets/include/wx/wx.h:16,
                 from main.cpp:2:
c:/wxWidgets/include/wx/string.h:141:31: error: 'strcasecmp' was not declared in this scope
   return strcasecmp(psz1, psz2);
                               ^
c:/wxWidgets/include/wx/list.h: In constructor 'wxListKey::wxListKey(const wxChar*)':
In file included from c:/wxWidgets/include/wx/wx.h:18:0,
                 from main.cpp:2:
c:/wxWidgets/include/wx/list.h:406:36: error: 'strdup' was not declared in this scope
         { m_key.string = wxStrdup(s); }
                                    ^
c:/wxWidgets/include/wx/list.h: In constructor 'wxListKey::wxListKey(const wxString&)':
c:/wxWidgets/include/wx/list.h:408:44: error: 'strdup' was not declared in this scope
         { m_key.string = wxStrdup(s.c_str()); }
                                            ^
main.cpp: In function 'int main()':
main.cpp:77:13: error: no matching function for call to 'MyFrame::MyFrame()'
     MyFrame f;
             ^
main.cpp:77:13: note: candidate is:
main.cpp:45:1: note: MyFrame::MyFrame(const wxString&, const wxPoint&, const wxSize&)
 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 ^
main.cpp:45:1: note:   candidate expects 3 arguments, 0 provided


Result for both errors:

BUILD FAILED (exit value 2, total time: 3s)


I do not understand what the problem is with this... (i mean, I assume whom ever wrote the library knew what they were doing... so... what am I doing wrong??)
Last edited on
Here is the code that resulted in the above errors:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>
#include "wx/wx.h"

using namespace std;

class MyApp: public wxApp
{
    virtual bool OnInit();
};

class MyFrame: public wxFrame
{
public:

    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);

    DECLARE_EVENT_TABLE()
};

enum
{
    ID_Quit = 1,
    ID_About,
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(ID_Quit, MyFrame::OnQuit)
    EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( _("Hello World"), wxPoint(50, 50),
                                  wxSize(450,340) );
    frame->Show(true);
    SetTopWindow(frame);
    return true;
} 

MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame( NULL, -1, title, pos, size )
{
    wxMenu *menuFile = new wxMenu;

    menuFile->Append( ID_About, _("&About...") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _("E&xit") );

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, _("&File") );

    SetMenuBar( menuBar );

    CreateStatusBar();
    SetStatusText( _("Welcome to wxWidgets!") );
}

void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    Close(TRUE);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxMessageBox( _("This is a wxWidgets Hello world sample"),
                  _("About Hello World"),
                  wxOK | wxICON_INFORMATION, this);
}

int main()
{
    MyFrame f;
    return 0;
}
You need to add %WXWIN%\lib\gcc_lib\msw\ as library search path (included directories).

Please note that actual path could be different in your build setup.
Do not ever attempt to rename any wxwidgets headers as this could have unexpected results and must be avoided.


A wxWidgets application does not have main() as entry point. This is a single file wxwidgets example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * hworld.cpp
 */

#include <wx/wx.h> 

class MyApp: public wxApp
{
    virtual bool OnInit();
};

class MyFrame: public wxFrame
{
public:

    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);

    DECLARE_EVENT_TABLE()
};

enum
{
    ID_Quit = 1,
    ID_About,
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(ID_Quit, MyFrame::OnQuit)
    EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( _("Hello World"), wxPoint(50, 50),
                                  wxSize(450,340) );
    frame->Show(true);
    SetTopWindow(frame);
    return true;
} 

MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame( NULL, -1, title, pos, size )
{
    wxMenu *menuFile = new wxMenu;

    menuFile->Append( ID_About, _("&About...") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _("E&xit") );

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, _("&File") );

    SetMenuBar( menuBar );

    CreateStatusBar();
    SetStatusText( _("Welcome to wxWidgets!") );
}

void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    Close(true);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxMessageBox( _("This is a wxWidgets Hello world sample"),
                  _("About Hello World"),
                  wxOK | wxICON_INFORMATION, this);
}



You should build samples from %WXWIN%\samples by executing
mingw32-make -f makefile.gcc SHARED=0 UNICODE=0 BUILD=release
on that folder (you MUST use the same options as the one used when you build wxwidgets itself).
http://www.wxwidgets.org/docs/tutorials/hello.htm

Also, does wxFormBuilder create resource/header files like resedit, or does it do some other stuff as well?


No, it does not create resources ( only windows uses resources anyway, think about Linux or Mac OS X ), instead it directly generate C++ classes for you (headers and implementation files).
http://sourceforge.net/apps/mediawiki/wxformbuilder/index.php?title=Tutorials:UsingWxFormBuilder
Last edited on
Huh, Thanks, I'll look into that.
ok... I ran the following code. After the code, is the errors I get:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "wx/wx.h" 

class MyApp: public wxApp
{
    virtual bool OnInit();
};

class MyFrame: public wxFrame
{
public:

    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);

    DECLARE_EVENT_TABLE()
};

enum
{
    ID_Quit = 1,
    ID_About,
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(ID_Quit, MyFrame::OnQuit)
    EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( _("Hello World"), wxPoint(50, 50),
                                  wxSize(450,340) );
    frame->Show(true);
    SetTopWindow(frame);
    return true;
} 

MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame( NULL, -1, title, pos, size )
{
    wxMenu *menuFile = new wxMenu;

    menuFile->Append( ID_About, _("&About...") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _("E&xit") );

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, _("&File") );

    SetMenuBar( menuBar );

    CreateStatusBar();
    SetStatusText( _("Welcome to wxWidgets!") );
}

void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    Close(TRUE);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxMessageBox( _("This is a wxWidgets Hello world sample"),
                  _("About Hello World"),
                  wxOK | wxICON_INFORMATION, this);
}


"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/JonathanWitlock/Desktop/C++/wxWidgets Test'
"/usr/bin/make"  -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/wxwidgets_test.exe
make[2]: Entering directory `/c/Users/JonathanWitlock/Desktop/C++/wxWidgets Test'
mkdir -p build/Release/MinGW-Windows
rm -f build/Release/MinGW-Windows/main.o.d
g++ -m32 `wx-config --cxxflags`    -c -O2 -Wall -s -I/C/wxWidgets/include -std=c++11 `wx-config --cxxflags` -MMD -MP -MF build/Release/MinGW-Windows/main.o.d -o build/Release/MinGW-Windows/main.o main.cpp
/bin/sh.exe: wx-config: command not found
/bin/sh.exe: wx-config: command not found
In file included from c:/wxWidgets/include/wx/defs.h:21:0,
                 from c:/wxWidgets/include/wx/wx.h:15,
                 from main.cpp:1:
c:/wxWidgets/include/wx/platform.h:196:22: fatal error: wx/setup.h: No such file or directory
 #include "wx/setup.h"
                      ^
compilation terminated.
make[2]: *** [build/Release/MinGW-Windows/main.o] Error 1
make[2]: Leaving directory `/c/Users/JonathanWitlock/Desktop/C++/wxWidgets Test'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/c/Users/JonathanWitlock/Desktop/C++/wxWidgets Test'
make: *** [.build-impl] Error 2


BUILD FAILED (exit value 2, total time: 937ms)


Apparently it still cant find files.

modoran wrote:
You need to add %WXWIN%\lib\gcc_lib\msw\ as library search path (included directories).


Should that be for the linker, C++ compiler, or the C compiler (or another tool perhaps)?

NetBeans offers a very broad set of compilation options (none of which I could tell were shared or unicode, but I'll try to find them).

EDIT1:

There are a lot of encoding options in the compiler setup menu. Currently set to UTF-8. Would rebuilding the library with Unicode enabled fix this?
Last edited on
I don't think he said anything about character encoding, the wxWidgets libs build to
%WXWIN%\lib\gcc_lib\msw\
, you need to add that to your PATH.
That path needs to be added for C++ compiler (g++.exe)
oh...

Should I turn Unicode on then? I just did a quick search. I built wxWidgets with unicode off.
Alright... new errors:

(clean, build)
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/username/Desktop/C++/wxWidgets Test'
"/usr/bin/make"  -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/wxwidgets_test.exe
make[2]: Entering directory `/c/Users/username/Desktop/C++/wxWidgets Test'
mkdir -p build/Release/MinGW-Windows
g++ -m32 `wx-config --cxxflags`    -c -O2 -Wall -s -I/C\wxWidgets\include -I%WXWIN%\lib\gcc_lib\msw -std=c++11 `wx-config --cxxflags` -o build/Release/MinGW-Windows/main.o main.cpp
/bin/sh.exe: wx-config: command not found
/bin/sh.exe: wx-config: command not found
main.cpp:1:20: fatal error: wx/wx.h: No such file or directory
 #include "wx/wx.h" 
                    ^
compilation terminated.
make[2]: *** [build/Release/MinGW-Windows/main.o] Error 1
make[2]: Leaving directory `/c/Users/username/Desktop/C++/wxWidgets Test'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/c/Users/username/Desktop/C++/wxWidgets Test'
make: *** [.build-impl] Error 2


BUILD FAILED (exit value 2, total time: 578ms)

---------------------------------------
In libraries:

other otpion: `wx-config --libs`
---------------------------------------
In C++ Compiler:

command line- additional options: `wx-config --cxxflags`
---------------------------------------

somthing is wrong... without those command line additions, the error is the same as with them.

Also, I changed the backslashes to forward slashes (to accomodate the windows path requirements). Tell me if this is wrong. With backslashes, I get the same errors.
Last edited on
Is %WXWIN% set in your en vironment, try
echo %WXWIN%
if it expand to the wxwidgets directory its ok if not you'll need to replace it in the settings with the actual path.
It's not even there, so I went to system properties and added:

%WXWIN%
C:\wxWidgets


I will compile my program.

EDIT1:

I can not seem to get the environment variable to work...
Last edited on
Replace %WXWIN% to C:\wxWidgets or something like that. The installer from wxwidgets website does setup %WXWIN% for you, but once you renamed wxwidgets directory, it is no longer a valid path.

Also wx-config is only used in Linux (I know there is some wx-config.exe port for windows too), does Netbeans uses Cygwin or MSYS under the hood ? It seems very odd if you are using windows ...
oh nvm, I got the environment Variable to work.

so, now whenever I use:

%WXWIN%, it expands to C:\wxWidgets

But it still returns compiler errors... Still "no such file or directory"
Last edited on
Maybe this is wrong, look here:

g++ -m32 `wx-config --cxxflags`    -c -O2 -Wall -s -I/C\wxWidgets\include -I%WXWIN%\lib\gcc_lib\msw -std=c++11 `wx-config --cxxflags` -o build/Release/MinGW-Windows/main.o main.cpp

Shouldn't it be C: instead of C?
oh wow... ill fix that

um... I can't fix that.

I added
C:\wxWidgets\include


And it modifies out the semi colon for some reason. I made it an environment variable and it still wont work.

Without the include folder, it spits out the same error
Last edited on
try using a relative folder?
So, compilers like relative folders??

Thnanks for the tip...
Not sure if they do actually prefer them, but I'm almost sure they accept them.
And, yes, your error lies in that line.
I've written all above messages from mobile so let me explain why I thought of this, now:

The exact command -I you have there (-I/C\wxWidgets\include) means:

Add an Include directory, and let it be C\wxWidgets\include
But as it doesn't exist, it is ignored?
As it is ignored, it cannot find wx/wx.h inside that folder.

Isn't there any project for wxWidgets to be compiled?
Because it seems like you're having lots of troubles.

Also remember you cannot make a library with GCC if you won't compile your entire program with GCC.
Pages: 123