Re: Cannot find library under Windows



laurent waro escribió:

Well,
if someone try to programs with GTK under windows by DevC++ (which provide actually a package for GTK+), is it necessary to install too the pakage founded on http://www.gimp.org/~tml/gimp/win32?
On this site, the webmaster notes that it's necessary to :

"*With gcc, you should use the -mno-cygwin and -mms-bitfields flags.* Using any other gcc setup will not work. This is because od struct field alignment If you don't understand what I am talking about, just trust me."

So, my last question is : Does DevC++ (wich use gcc) make it (I mean *use the -mno-cygwin and -mms-bitfields flags)* automatically or must we do it ourself?

No. You must do it yourself.

Thanks for your help and clarification about that. Thanks toTor Lillqvist for his intervention in this mailing list!

Oups! Sorry for my horrible English, I'm french. Greets from Réunion Island!

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


In www.dropline.net I fund this tutorial that help me to try Dev-C++ and GTK:


"Greetings. This is my humble attempt at writing an easy to follow tutorial on how to install a GTK+ 2.x.x and Dev-C++ 5 environment. I know there are already two methods that are outlined on this site, but as both of them were ambiguous to me and led me around for a few hours, I figured I'd see if I could make it a bit more explicit. As of the time of writing the current relevant versions are Dev-C++ 4.9.8.5 and GTK+ 2.2.4.1.

--Installing Dev-C++

At this point, Dev-C++ 5 is still "beta" because it is implements GCC 3.2, a new version of the C compiler which has incompatabilities with older code. I haven't done any real testing yet, but I believe the DevPak's for GTK+ provided by bloodshed are outdated and _do not_ run on their newer version of the software. If you are going to use Dev-C++ 5 (which is what I am demonstrating here) make sure you don't use the DevPaks from the Dev-C++ resource site; I had alot of trouble with it and eventually had to wipe everything and reinstall.

Grab Dev-C++ 5 from here: http://www.bloodshed.net/dev/devcpp.html

The download link is half way down the page. After you've downloaded it, run the self extracter yadda yadda until it is installed. Remember the directory you have installed it to, in our example c:\Dev-Cpp\. Then start up Dev-C++, go to Tools->"Check for Updates/Packages", and update Dev-C++ to the newest version available. Afterwards exit the program.

--Installing GTK+

Grab the two GTK+ installers for the Runtime Environment and the Development Environment from the download section of this site (http://www.dropline.net/gtk/download.php). Install the Runtime first, to any directory (but remember where it is), in this example c:\gtk-runtime\. Now install the Development Environment, but make sure you change the install path to the _root directory of Dev-C++_! In this example, that would be c:\Dev-C++. This will set up all the libs/includes in the correct folders to be used later by Dev-C++. once its done, we technically have all the code in place, we just have to configure our Dev-C++ project.

--Configuring a project

Start Dev-C++ and create a new project. Choose a name and location (doesnt really matter where) and open up a dos app. It should pop up with the default main.cpp - Now go to Project -> Project Options. Click the Directories tab, and then the Include Directories tab. You can add include directories to this listing by clicking the folder in the lower right-hand corner, browsing for the directory, then hitting Add. Go ahead and do so to add the following relative directory paths (i.e. "include\bob" would mean C:\Dev-Cpp\include\bob in our example) to the list:

include\gtk-2.0
lib\gtk-2.0\include
include\atk-1.0
include\glib-2.0
include\pango-1.0
lib\glib-2.0
lib\glib-2.0\include

After adding the above and verifying they are correct, click the upper tab Parameters. If you are going to be coding in C++, add the following to the
C++ compiler" box:


-mno-cygwin -mms-bitfields


This will make sure it doesnt find incorrectly sized windows and such.

Also add the following to the Linker box:



-lgtk-win32-2.0 -lgdk-win32-2.0 -lgthread-2.0 -lgdi32 -lole32 -luuid -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv



That will add in all the libs we need to compile our GTK+ project. Now we need to tell the compiler where the runtime libs are so it can run the GTK+ program after we compile/link it. Hit ok to close out of that tab and head to Tools-> Compiler Options. Under the Directories tab, add an entry pointing to the \lib directory of the Runtime Environment you installed earlier, in our case C:\gtk-runtime\lib. Hit Ok to close out of that and you should be good to go!

Write some GTK+ application in your .cpp, remembering to include <gtk/gtk.h>. You might want to try the Hello World over at gtk.org (under the 2.0 tutorial) just for testing. If everything went correctly, you should have a GTK+ enabled Dev-C++ IDE. You might have some problems with errors telling you the program cannot find certain DLL's like iconv and libglib-2.0-0, in which case you have two options: copy them over to the project directory to temporarily test that it is indeed working, or edit the registry to let windows know where the program's dll's are located."

I hope that helps you.

Have a nice day.
Eduardo Lopez








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]