ID:277292
 
I decided to learn some C++ over my winter break, so I got Dev C++ and the Allegro library files. I followed a tutorial, but when I compile this code :

#include <allegro.h>

const int scrx=640;
const int scry=480;

int main(int argc, char *argv[]) {
allegro_init(); // Initialize the allegro file
install_keyboard(); // Initialize the keyboard
set_gfx_mode(GFX_AUTODECT,640,480,0,0); // Change raphics mode to 640x480
readkey(); //Wait until a key is pressed
return 0; //Exit the program
}

END_OF_MAIN(); // This must be called right after the closing bracket of your MAIN function.
// It is Allegro specific.


It gives me the following error:
`GFX_AUTODECT' undeclared (first use this function)

I've checked the code over and over on the site and compared it with mine, and it is exactly the same. What do I do?
The site says GFX_AUTODETECT. You have GFX_AUTODECT.
In response to Cinnom
Ahahaha...I guess I didn't check it enough times D:
Now I am getting all these undefined references, it's as if as I never installed the libraries?
Errors:
[Linker error] undefined reference to `_install_allegro_version_check'
[Linker error] undefined reference to `install_keyboard'
[Linker error] undefined reference to `set_gfx_mode'
[Linker error] undefined reference to `readkey'
[Linker error] undefined reference to `_WinMain'
And then this misfit error:
ld returned 1 exit status

Is my lib screwed up?
In response to Dead_Demon
You need to tell the linker to link to Allegro. (The #include directive is only half the battle - it only keeps the compiler happy.) I haven't used Allegro so I don't know exactly how it's set up, but you should be able to find out via a Google search.
In response to Crispy
Thank you. That was the problem. Now all I have to do is figure out how to get it to run...says no host application was provided <<
In response to Dead_Demon
Is that an Allegro error, a compiler error or a linker error? In the first case, you may want to check for a 'start_of_main()' thing (I haven't used allegro either but I'm guessing), in the second case I have no idea wtf's going on, and in the third case you probably need to fiddle with the linker settings - try loading up a set of files that does compile and check out the linker stuff - starting with a blank project in some IDEs will not set up the linker.
In response to Dead_Demon
Dead_Demon wrote:
Now all I have to do is figure out how to get it to run...says no host application was provided <<

You didn't compile a DLL, did you? You don't want a DLL. You want a standard Windows executable. Check your Dev-C++ project's settings. I think it's under the General tab.
Dead_Demon wrote:
I decided to learn some C++ over my winter break, so I got Dev C++ and the Allegro library files. I followed a tutorial, but when I compile this code :

> #include <allegro.h>
>
> const int scrx=640;
> const int scry=480;
>
> int main(int argc, char *argv[]) {
> allegro_init(); // Initialize the allegro file
> install_keyboard(); // Initialize the keyboard
> set_gfx_mode(GFX_AUTODECT,640,480,0,0); // Change raphics mode to 640x480
> readkey(); //Wait until a key is pressed
> return 0; //Exit the program
> }
>
> END_OF_MAIN(); // This must be called right after the closing bracket of your MAIN function.
> // It is Allegro specific.
>
>

It gives me the following error:
`GFX_AUTODECT' undeclared (first use this function)

I've checked the code over and over on the site and compared it with mine, and it is exactly the same. What do I do?

Why are you doing c++ in Byond which does DM??

Need any help with C++, I am very good at C++, I just got my Rendering System for my GameEngine in C++, and used Dev-C++ compiler.

Yahoo: lil_main9
AIM: WANGSTAHOOD
email: [email protected]
In response to LilMain
<_<

That's all that's to be expressed.
In response to LilMain
Why are you doing c++ in Byond which does DM??
I think he is just using the DM tags.