# dev-c++

This topic is 4197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So I'm going on a trip at the end of the month. I don't have a laptop so I borrowed one from my dad. It's a really old one so it's really slow and has like no space on it to install much of anything. Anyway, I put dev-c++ on it and downloaded the allegro devpack. I tried moving my project over from vs.net 2003. I set up an allegro project in dev-c++ and put all the .h and .cpp files in and tried to compile and I get a bunch of errors now. Stuff like no newline at end of file, linker errors etc. It seems allegro set up fine and all the errors have to do with it just not liking the way my code is set up. It compiles and runs fine in vs.net so I was wondering is this common for dev-c++ to find all kinds of different errors? This is my first time trying it out. On a side note, I'm looking for some simple little games that don't take up much room that I might fit on this piece of junk :P

##### Share on other sites
Yes, it's quite common to find small problems like that when moving a project from IDE to IDE (especially since you're also using different compilers there). You shouldn't find any that are a major difficulty to fix unless you've relied on some non-standard behavior provided by your compiler.

Just work through them (the errors), and if any of them are particularly difficult for you to figure out feel free to ask what might be the cause.

##### Share on other sites
Well the errors aren't the most descriptive. I get:

[Linker error] undefined reference to 'game'

more undefined references to 'game' follow
Id returned 1 exit status

There are no line numbers or files listed. I guess it doesn't like the way I'm using externs. I have a CGame class and in main I create a global CGame object.
I list this as extern in my CMob class .cpp file so that the class can access the game object stuff. This worked fine in vs.net but apparently dev-c++ has issue with it. Am I doing something wrong here? I thought this was the right way to do it but my knowledge is still pretty limited.

##### Share on other sites
You don't want to be declaring things extern in a cpp file. You declare it extern in a header file that everything that uses it includes, then actually define it (without extern) in a cpp file somewhere.

Example

game.h
class Game{public:    Game(int State);};extern Game game;

game.cpp
Game game(42);

main.cpp
#include "game.h"int main(whatever){    // use game;}

HTH Paul

##### Share on other sites
Thanks EC. I think that is how I originally had it in VS but I was having problems with it. I'll try switching things over that way again and see what happens. [smile]

##### Share on other sites
Ok, I thought these were all errors but they are just warnings. I am able to run it and man is it slow on this laptop. I guess it will be good practice for performance tweaking? lol My little pacman moves slower than poo. It still says I'm getting 60fps though so maybe my fps code is wrong or something. [grin]

##### Share on other sites
Dev-C++ is the MinGW variant of GCC which is much more standards-compliant than VC++ although the later versions of VC++ are better than the earlier ones. This would explain all the warnings that MinGW is generating.

-edit- One more thing to check for is that some early graphics chips don't support alpha blending so make sure your overlays are using colorkey or 256-color mode to do the transparency blitting.

##### Share on other sites
Thanks for the info samuraicrow. I'm pretty sure my bitmaps are 256 color with the pink for masked blits. I think while I'm on vacation I will just rework the entire program and try to see what I can do to improve performance on such an old system. I think this thing is like a pentium 1 with 48 mb RAM hehe. According to device manager the video card is an S3 Aurora64V+. I'm gonna guess that's nothing spectacular. I wish I could afford a decent laptop so I wouldn't have to borrow this thing. [grin]

##### Share on other sites
Dev-C++ is an IDE (Integrated Development Enviroment) and can use variants of GCC like MinGW and Cygwin.

##### Share on other sites
Quote:
 Original post by nomichiOk, I thought these were all errors but they are just warnings. I am able to run it and man is it slow on this laptop. I guess it will be good practice for performance tweaking? lol My little pacman moves slower than poo. It still says I'm getting 60fps though so maybe my fps code is wrong or something. [grin]

Get yourself a copy of FRAPS on the laptop and confirm the real fps. If your code is frame-based for movement speeds and you really are getting the same frame rate as before, you should be getting the same movement speed as before (Dr Obvious statement of the day). FRAPS is a dead easy and reliable way to find this out without messing about.

##### Share on other sites
Quote:
 Original post by EasilyConfusedGet yourself a copy of FRAPS on the laptop and confirm the real fps. If your code is frame-based for movement speeds and you really are getting the same frame rate as before, you should be getting the same movement speed as before (Dr Obvious statement of the day). FRAPS is a dead easy and reliable way to find this out without messing about.

Good idea, I'll look into it later today. Thanks.

##### Share on other sites
For those warnings, there is a place to import a VC++ project to Dev-C++. It is under file-->import. I don't know if that helps (never tried it myself), but it might.

##### Share on other sites
Quote:
 Original post by bschneidFor those warnings, there is a place to import a VC++ project to Dev-C++. It is under file-->import. I don't know if that helps (never tried it myself), but it might.

Yea, I tried that first. It didn't recognize the project at all. I'm guessing the visual studio c++ is not the same as just vc++?

##### Share on other sites
They're the same. "Visual Studio" technically refers to the entire suite of "Visual *" products (Visual C#, Visual C++, &c., excepting the Express editions which are seperate applications, though the project format is the same). Often VC and VS are used interchangeably.

##### Share on other sites
Quote:
Original post by nomichi
Quote:
 Original post by bschneidFor those warnings, there is a place to import a VC++ project to Dev-C++. It is under file-->import. I don't know if that helps (never tried it myself), but it might.

Yea, I tried that first. It didn't recognize the project at all. I'm guessing the visual studio c++ is not the same as just vc++?

Visual studio refers to the IDE, While Visual C++ refers to the language and/or compiler. It sounds like Dev-C++ is expecting a project from and earlier version of Visual studio, hence the problems.

As for the warning about a lack of newline, you can easily add a newline to the end of each file. In the olden days, the compilers need the extra whitespace to properly compile the file. G++ will still warn you if you forget, just in case you plan on using earlier compilers, whereas Visual Studio just ignores it completely.

##### Share on other sites
I see, I guess it wanted an earlier version than :) I did simply add the newlines, I assumed it was something with how the file was parsed or something. I guess this is turning out to be a good learning experience about the different IDE's and compilers.

Thanks guys.

##### Share on other sites

This topic is 4197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628647
• Total Posts
2984034

• 10
• 9
• 9
• 10
• 21