How to build libraries with makefiles ? Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Pokko
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Aug 17, 2007 6:02 pm

How to build libraries with makefiles ?

Post by Pokko »

Hi,
although there are many threads concerning makefiles, I still don't know how to handle these files. :oops:

Can anyone explain what exactly I have to do to build libraries?

Let's get more precisely: I have the newest wxDevC++ installed, and I'm running WinXP Pro.
Let's take for example wxCTB. I downloaded the version 0.8 from here: http://www.iftools.com/ctb.en.html
unpacked it and changed to the build directory.

There are some makefiles. Since I use MingW the right makefile is the makefile.gcc, right? Now when I try this on command line: mingw32-make -f makefile.gcc
this error occurs:
F:\libwxctb-0.8\build>mingw32-make -f makefile.gcc
g++ -c -o wxctb_lib_expect.o -DNDEBUG -O2 -mthreads -I..\include -MTwxctb_lib
_expect.o -MFwxctb_lib_expect.o.d -MD ../src/expect.cpp
../src/expect.cpp:10:19: stdio.h: No such file or directory
../src/expect.cpp:11:20: string.h: No such file or directory
In file included from ../include/wx/ctb/expect.h:13,
from ../src/expect.cpp:13:
../include/wx/ctb/iobase.h:13:23: sys/types.h: No such file or directory
../include/wx/ctb/iobase.h:14:20: stddef.h: No such file or directory
In file included from ../include/wx/ctb/expect.h:13,
from ../src/expect.cpp:13:
../include/wx/ctb/iobase.h:146: error: `size_t' has not been declared
../include/wx/ctb/iobase.h:146: error: ISO C++ forbids declaration of `len' with
no type
../include/wx/ctb/iobase.h:180: error: `size_t' has not been declared
../include/wx/ctb/iobase.h:180: error: ISO C++ forbids declaration of `len' with
no type
../include/wx/ctb/iobase.h:190: error: `size_t' has not been declared
../include/wx/ctb/iobase.h:190: error: ISO C++ forbids declaration of `len' with
no type
../include/wx/ctb/iobase.h:204: error: `size_t' has not been declared
../include/wx/ctb/iobase.h:204: error: ISO C++ forbids declaration of `len' with
no type
In file included from ../include/wx/ctb/timer.h:14,
from ../src/expect.cpp:14:
../include/wx/ctb/win32/timer.h:15:21: windows.h: No such file or directory
In file included from ../include/wx/ctb/timer.h:14,
from ../src/expect.cpp:14:
../include/wx/ctb/win32/timer.h:34: error: `MMRESULT' does not name a type
../include/wx/ctb/win32/timer.h:72: error: `DWORD' does not name a type
../include/wx/ctb/win32/timer.h:76: error: `MMRESULT' does not name a type
../src/expect.cpp: In constructor `Expect::Expect(wxIOBase*)':
../src/expect.cpp:25: error: `NULL' undeclared (first use this function)
../src/expect.cpp:25: error: (Each undeclared identifier is reported only once f
or each function it appears in.)
../src/expect.cpp: In member function `char* Expect::Received()':
../src/expect.cpp:51: error: `strcat' undeclared (first use this function)
../src/expect.cpp: In member function `int Expect::Send(char*, char*)':
../src/expect.cpp:81: error: `NULL' undeclared (first use this function)
../src/expect.cpp:88: error: `strlen' undeclared (first use this function)
../src/expect.cpp:105: error: `FALSE' undeclared (first use this function)
../src/expect.cpp:105: error: `SleepEx' undeclared (first use this function)
../src/expect.cpp: In member function `int Expect::Sendv(char*, char*)':
../src/expect.cpp:155: error: `strcmp' undeclared (first use this function)
../src/expect.cpp:159: error: `NULL' undeclared (first use this function)
mingw32-make: *** [wxctb_lib_expect.o] Error 1
Now what am I doing wrong?
The readme doesn't help in any way.
I'm trying to understand where the problem is, so next time with another package I hope I know what to do.

Thanks.

Rino
Pokko
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Aug 17, 2007 6:02 pm

Post by Pokko »

No one can help me?
I still don't get it...
biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab »

You've to specify the include directories where the stdio.h and other header files reside. I don't use wxDevC++ so I'm not sure where do they exist.

But let's say the the stdio.h is in C:\Program File\wxDevCPP\mingw\include then you can specify that to the makefile as

Code: Select all

mingw32-make -f makefile.gcc CFLAGS="-IC:\Program File\wxDevCPP\mingw\include -I<Other_Include_Dirs>" CPPFLAGS="-IC:\Program File\wxDevCPP\mingw\include -I<Other_Include_Dirs>"
I find that the wxWidgets directory is also missing. So add other additional include directories to it by replacing <Other_Include_Dirs> with an include dir.
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
Although I wouldn't recommend using the makefile, as configure is a way better solution, here's a small tutorial I wrote for compiling 2.6.0 (so it's outdated in some places). It *might* work for newer versions as well, but I have no plans to update it.

http://upcase.de/devpack.html
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Pokko
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Aug 17, 2007 6:02 pm

Post by Pokko »

Thanks!! It worked with
mingw32-make -f makefile.gcc CFLAGS="-IC:\Program File\wxDevCPP\mingw\include -I<Other_Include_Dirs>" CPPFLAGS="-IC:\Program File\wxDevCPP\mingw\include -I<Other_Include_Dirs>"
after I entered my directory path.
Sometimes its so easy, if only you know... (and have the makefile.gcc)

Although I wouldn't recommend using the makefile, as configure is a way better solution, ...
Sounds interesting, what does this way look like? Of course its always good to know other ways to do one thing.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Pokko wrote:Sounds interesting, what does this way look like? Of course its always good to know other ways to do one thing.
Have a look at the install.txt file that came with wxWidgets sources, it has a section that explains this.

Basically "configure" is a shell script that will, as the name suggests, configure your build and create makefiles for you. As MSYS is a unix type shell it can process these scripts. The cool things about configure (which is pretty common on unixes for building from source) it that it normaly allows you to explicitly specify what you want to build (like what additional components should be build) and that it checks that everything can be build before actually doing so. For example it checks if you have all other needed libraries installed, if it can find the headers, etc.

This is a much more simpple way compared to a static makefile. You simply do a "./configure", wait until it finishes, issue a "make" and optionaly (on unix) a "make install". Boom, finished.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Pokko
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Aug 17, 2007 6:02 pm

Post by Pokko »

Sounds great, if there is a configure file!
I'll give it a try these days.

Thank you both for your help.

Rino
Post Reply