Sign in to follow this  

interesting devc++ bug

Recommended Posts

hey just wondering if anyone has experienced this in devc++. just yesterday i migrated from MinGWStudio to Dev-C++ 5.0 beta 9 and encountered the strangest thing. my project is opengl based and after setting up the linking options it rebuilt fine from the ide (well it should its using the same compiler) anyways when i run the program from the ide the program does not function properly and gfx are not displayed in the correct place and text strings have strange numbers appended to them. however if i execute the same build from windows explorer the program functions exactly as intended. im positive its not an old version im running from explorer and a newer build from the ide, its the same executable. has anyone experienced this? why would something like this happen?

Share this post

Link to post
Share on other sites
Maybe it's because Dev-Cpp manages the makefile for you. It may add some compile parameters your project doesn't like. Check the project settings and the file.


Share this post

Link to post
Share on other sites
I rarely use DevC++ so I’m basing this on my experience with MSVC++:
You mentioned that the graphics do not display correctly/at all. When running the program from the IDE (in VC++ at least) the program starts in the directory of the project file. However, when running manually from explorer the program starts in the directory the exe exists in. Could it be that your external files are in a directory relative to the built exe rather than the project file (.dsw in VC++)?

I address this issue by insterting this segment of code at application initialization to set the ‘current directory’ to the directory that the exe exists in:

//The application directory
char strAppDir[ MAX_PATH ];
char * pStr;
GetModuleFileName( AppHINSTANCE, strAppDir, MAX_PATH );
pStr = strrchr( strAppDir, '\\' );
if ( pStr != NULL )
*( ++pStr ) = '\0';
SetCurrentDirectory( strAppDir );

Hope this helps,
Jackson Allan

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