Sign in to follow this  
KingSatchmo

Does Dev C++ do windows?

Recommended Posts

Hello, I've been programming in Dev-C++ in DOS for a couple of weeks, mostly doing problem solving programs, and have recently made the switch over to windows programming, specifically using "SAMS Teach yourself GAME PROGRAMMING in 24 Hours." Granted, not a smart choice on my part to try to learn windows programming through a game programming book, but its all I have available, and I did not feel like spending any more time on DOS. Plus learning how to program games is the step I would eventually like to end up at. But my problem is I keep having problems with Dev-C++ when trying to make very very very basic windows programs... like ones that just open a window. Whenever I use the examples in the CD, they work fine, so obviously Dev-C++ includes the windows.h library, but whenever I try to take out his code and stick in mine, it never works. I get errors like this:
Quote:
[Linker error] undefined reference to `GameEngine::GameEngine(HINSTANCE__*, char*, char*, unsigned short, unsigned short, int, int)'
and
Quote:
[Linker error] undefined reference to `TextOutA@20'
and I have no idea what these mean. By all accounts it should work, my GameEngine looks fine, all the headers and files are linking up right, but for some reason I always get that error. While we are on the subject, is there a good article on basic windows programming on the internet that I could use before trying this game programming that is way over my head?

Share this post


Link to post
Share on other sites
Quote:
Original post by VBStrider
Is this GameEngine part of a .lib file? If so, you may not be linking correctly.

It's kind of hard to know what is wrong without seeing the code. :/

VBStrider


Hows does one go about posting all my code? I could just put the folder somewhere...?

Share this post


Link to post
Share on other sites
To be quite honest, the errors are pretty self-explanatory. It can't find the implementation of

GameEngine::GameEngine(HINSTANCE__*, char*, char*, unsigned short, unsigned short, int, int)

and of

TextOutA();

If those are functions you wrote yourself, make sure that the declaration and definition match. If those are library functions, make sure you are linking with the required libraries.




Share this post


Link to post
Share on other sites
Could it have something to do with his executables? When I try to compile and run his examples, I get the above said errors, when I JUST run his examples, they work fine... I'm too new to apply logic to this, what could this mean?

Share this post


Link to post
Share on other sites
It means that his example is using external libraries that you are not linking to. You need to link to those library in your project settings in order for it to link. (Those are linker errors, not compiler errors.)

Share this post


Link to post
Share on other sites
Quote:
Original post by jfclavette
It means that his example is using external libraries that you are not linking to. You need to link to those library in your project settings in order for it to link. (Those are linker errors, not compiler errors.)


I think some functions got lost in translation between the 3 headers and 2 source files that make up this oh so simple program. If I can't even figure out how to get a program that opens a window, that uses an engine, to run, then I think I need to go over what I've already been through. This book is very sketchy when it comes to the basics of windows programming, and if I don't start off on the right foot then I am royally screwed for the rest of my career. So I think I'll go get another book or find another article that is very precise and does a very good job explaining the basics. Could you possibly point me in the right direction?

P.S. Thanks for your help; I do get what you are saying, I just have no earthly idea how to go about fixing it.

Share this post


Link to post
Share on other sites
I don't use Dev-C++ much, so I am unsure where it shows you the library files that it is linking to (if it is). If you could list off all the files from this particular example code's original folder (off the CD I am assuming), that may help us figure out what is wrong.

Oh, and a place where you can temporarily "paste" code is here: http://www.rafb.net/paste/

VBStrider


EDIT: Link fixed.

Share this post


Link to post
Share on other sites
If you want to know how to go about finding which additional libraries you're linking in, then follow these images:


Click on the project button in the toolbar and then click on the project options button.


Click on the parameters tab, your additional libraries will be in the "Linker" box to the right (ignore -lopeng32l).

Good luck!

Share this post


Link to post
Share on other sites
heh did you write the GameEngine class yourself? if then, do you have a seperate cpp file with the implementations, or are they all in there with the header file? cuz i think dev-CPP doesn't automatically recompile header files if changes are made to them, you would have to do make clean and makefrom scratch. Did you define the functions of GameEngine at all? if you didn't write the GameEngine class, then you probably just need to link to it in project options -> parameters -> linker and put like -lgameengine or whatever it is. (if something was called liba.a, youd put -la, if you didnt know how that worked.)

Share this post


Link to post
Share on other sites
Quote:
Original post by KingSatchmo
Hello,
I've been programming in Dev-C++ in DOS for a couple of weeks, mostly doing problem solving programs, and have recently made the switch over to windows programming, specifically using "SAMS Teach yourself GAME PROGRAMMING in 24 Hours." Granted, not a smart choice on my part to try to learn windows programming through a game programming book, but its all I have available, and I did not feel like spending any more time on DOS. Plus learning how to program games is the step I would eventually like to end up at. But my problem is I keep having problems with Dev-C++ when trying to make very very very basic windows programs... like ones that just open a window. Whenever I use the examples in the CD, they work fine, so obviously Dev-C++ includes the windows.h library, but whenever I try to take out his code and stick in mine, it never works. I get errors like this:
Quote:
[Linker error] undefined reference to `GameEngine::GameEngine(HINSTANCE__*, char*, char*, unsigned short, unsigned short, int, int)'

and
Quote:
[Linker error] undefined reference to `TextOutA@20'


and I have no idea what these mean. By all accounts it should work, my GameEngine looks fine, all the headers and files are linking up right, but for some reason I always get that error.
While we are on the subject, is there a good article on basic windows programming on the internet that I could use before trying this game programming that is way over my head?

Just a completly random question, but is your project a Windows Project?


EDIT: By which I mean, you selected "Windows Project" when you started a new project, right?

Share this post


Link to post
Share on other sites
I found my problem.... and how stupid I feel! I never actually made a project for my collection of files that I pulled together... </slaps himself> I guess I thought if they were in the same folder they would automatically connect... GAH I am some noob aye? Well I guess I will never make that mistake again...
While I am here, how do I get the icons in my folder to show up? The resource file is there and both the icons are in the folder and in the project but they still don't show up.
Specifically I am wondering what this code is in my game engine:
Quote:
wndclass.hIcon = LoadIcon(m_hInstance,
MAKEINTRESOURCE(GetIcon()));
wndclass.hIconSm = LoadIcon(m_hInstance,
MAKEINTRESOURCE(GetSmallIcon()));

and this is what I have in my main file:
Quote:
_pGame = new GameEngine(hInstance, TEXT("Practice"),
TEXT("Practice"), IDI_TRIPPY, IDI_TRIPPY_SM);

I am going to look this up in my book right now but I might as well get a second answer...

Thanks for all your help!

Share this post


Link to post
Share on other sites
Yes it does do windows, but it makes it much harder compared to Visual.

You cannot have intellisense or a similar feature, to my knowledge ( a utility which helps you complete statements)

Also, Visual comes with a huge reference of material for windows.

Dev cannot handle .NET development as far as I know, however.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this