Posts: 3,616
Threads: 287
Joined: Jan 2003
As long as I link my projects with -lalleg, I'm fine with Allegro on C using Dev-C++. :o
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 6,419
Threads: 74
Joined: Mar 2002
As far as I know, the DEVC++ IDE works exactly like the RHIDE that is used commonly with DJGPP. To create a project, you just open a new project and add files to it. To use a library, you open the libraries window and add libraries to it. Am I wrong?
TBBQ, which libraries are you using? maybe there is some kind of "interference". Using MSVC, as it includes the MFC as a default, you may run into trouble if you link to Allegro. Is this the case?
Posts: 4,307
Threads: 63
Joined: May 2003
I am using two libraries. Allegro Font and Allegro. I dont think there is any kind of interference since single module programs compile without any problem. But when I open a project and code multiple modules and try to compile them as a single program it doesnt work. It gives me two typical errors:
1. Undefined reference to -lalleg and -lalfont or something similar.
2. And something regarding _winmain(). This should've been eleminated by adding the-D__GTHREAD_HIDE_WIN32API
Posts: 358
Threads: 15
Joined: May 2003
Quote:Mango, which version of DevC++ are you using? Because it causes a hell of trouble when I am using Allegro in a project. It works fine with single modules. Do i need to pass any special parameters to the mingw32 compiler?
I'm using 4.9.8.7 currently. However, I'm just doing standard c++ stuff....I haven't figured out graphics yet, although I did run through a few open GL tuts, and have downloaded Allegro 404...I haven't experimented with allegro...I'm finding the nuts-n-bolts of c++ confusing (read challenging) enough for now
Posts: 530
Threads: 17
Joined: May 2002
Quote:Mango, which version of DevC++ are you using? Because it causes a hell of trouble when I am using Allegro in a project. It works fine with single modules. Do i need to pass any special parameters to the mingw32 compiler?
No, ive told you. DevC++ works great, and without problems.
Quote: Undefined reference to -lalleg and -lalfont or something similar.
2. And something regarding _winmain(). This should've been eleminated by adding the-D__GTHREAD_HIDE_WIN32API
The first is your not linking to the right libraries, are you linking it in your Linker flags or compiler flags? it belongs under linker flags. I can link to the following libraries for the same project, without any errors:
Code: -lalld or -lalleg
-lfmod
-llua
-llualib
...More to come here soon
Number 2 is Mingw's fault. Not that of Dev-C++ http://www.allegro.cc/forums/view_thread.php?_id=208366
In neither of your points do i see Dev-C++ at fault, so i dont see why you knock it.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Quote:I am using two libraries. Allegro Font and Allegro. I dont think there is any kind of interference since single module programs compile without any problem. But when I open a project and code multiple modules and try to compile them as a single program it doesnt work. It gives me two typical errors:
1. Undefined reference to -lalleg and -lalfont or something similar.
2. And something regarding _winmain(). This should've been eleminated by adding the-D__GTHREAD_HIDE_WIN32API
Hmmm...
1.-
GUESS a) -lalleg and -lafont are the parameters passed to the GCC-compatible compile to make it use alleg and afont libraries. Maybe your compiler can't find them
GUESS b) It can be that C++ projects should be made in another way if you want to use allegro. I don't really know. I found this:
Code: A simple example on how to create a little program with Dev-C++:
Launch Dev-C++ and create a new project (File/New Project). Select
"Windows Application", then click on the "Ok" button. Name your
project and give associate it to a new file. You should now see a
sample code in a window. Close that window since you won't be
needing it (Allegro is much simpler to use than this). Create a
new file (File/New Source File), then write a small Allegro
program. You can inspire yourself by the Allegro examples if you
wish. Here's a small program you can type to see if everything
worked until now:
#include <allegro.h>
int main() {
allegro_init();
allegro_message("Hello World!");
return 0;
}
END_OF_MAIN();
You now need to tell Dev-C++ that you'd like to make a program that
uses Allegro. For that, go in the Project Options screen
(Project/Project Options menu), then enter -lalleg (or -lalld for
the debug mode) in the box under 'Further object file or linker
options'.
Compile your project! Simply click on the green check mark on
your Dev-C++ toolbar. Correct any syntax errors in your code,
then click on "Execute" to run the program. If all worked
you will see a message box pop up with "Hello World" inside of it
Are you missing something?
Posts: 530
Threads: 17
Joined: May 2002
Nathan, on #2, see the link i posted in the thread above. It was an addition to the newer versions of the Dev-C++ based compiler(Mingw). Im guesign your using version 2.95 Still? Thats the one i use since ive been using allegro for a while and i find it stabler, and it compiles smaller .exe files. This was added in ver 3.12+, and i dont believe the've fixed the bugs for it.
C++ doesnt affect using allegro, unless your using mfc.
Posts: 6,419
Threads: 74
Joined: Mar 2002
oops, I was looking for the info while I wrote my reply so I didn't see yours. Case solved
(I have the bad habit of clicking "post" and then looking for info )
Posts: 4,307
Threads: 63
Joined: May 2003
Mango, I am using the 4.9.8.0 version of DevC++. Dont use 4.0.4 version of allegro, upgrade it. I dunno whats the latest but I'm using 4.1.11
Quote:Quote:Mango, which version of DevC++ are you using? Because it ca
uses a hell of trouble when I am using Allegro in a project. It works fine with single modules. Do i need to pass any special parameters to the mingw32 compiler?
No, ive told you. DevC++ works great, and without problems.
Quote: Undefined reference to -lalleg and -lalfont or something similar.
2. And something regarding _winmain(). This should've been eleminated by adding the-D__GTHREAD_HIDE_WIN32API
The first is your not linking to the right libraries, are you linking it in your Linker flags or compiler flags? it belongs under linker flags. I can link to the following libraries for the same project, without any errors:
Code: -lalld or -lalleg
-lfmod
-llua
-llualib
...More to come here soon
Number 2 is Mingw's fault. Not that of Dev-C++ http://www.allegro.cc/forums/view_thread.php?_id=208366
In neither of your points do i see Dev-C++ at fault, so i dont see why you knock it.
Here are the exact errors:
Quote:testmod1.cpp: undefined reference to `install_allegro'
testmod1.cpp: undefined reference to `allegro_exit'
testmod1.cpp: undefined reference to `_WinMain'
Also, I've added the -lalfont -lalleg flags to the linker. As I've said previously I got the same program to work properly when compiling in Linux (GCC) but I cant seem to be able to compile while using mingw32. I've even tried compiling the project using command line but it doesnt work.
Actually its too messy as I need to pass the include locations to the compiler which makes my command line go over 255 characters and subsequent problems follow...
Posts: 3,616
Threads: 287
Joined: Jan 2003
New project.
Code:
Code: #include <allegro.h>
int main() {
allegro_init();
return 0;
}
END_OF_MAIN()
Linked with -lalleg (and with all the DLLs in the windows/system folder).
Works fine.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
|