Thread: Loading Bitmap - Directories

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    1

    Unhappy Loading Bitmap - Directories

    Hello, I'm new to programming in DirectX and I know a bit of knowledge with C++ but I can not load a bitmap. I've been following a programming book (using DirectX9) and the code I wrote tells me that my bitmap is not in the "current directory" How do I place my .bmp file inside the right directory if I'm using Microsoft Visual Studio C++ 2010? Thanks in advance!

  2. #2
    Registered User
    Join Date
    Jan 2008
    Posts
    70
    By default Visual Studio sets the working directory to be the folder which contains the solution file (.sln file). If you put the bitmap in that folder you should be able to access it using "./test.bmp".

    I personally think that's a horrible place to put the working directory given that when you try to run the exe from explorer its working directory will be the folder in which it is contained. This means that your program will run quite differently from explorer and from visual studio. You can change visual studio's working directory by going to.

    Project Properties->Config Properties->Debugging
    Change Working Directory to: $(OutDir)

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Ideally you should create an asset system in your code that can find the assets based on user supplied paths or hard-coded relative paths relative to your bin.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Loading a bitmap (Without using glaux)
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 03-16-2006, 09:43 AM
  2. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  3. Loading a Bitmap resource for OpenGL Texture[x]
    By the dead tree in forum Game Programming
    Replies: 4
    Last Post: 08-26-2004, 01:12 PM
  4. Loading bitmap in dll
    By Mithoric in forum Windows Programming
    Replies: 2
    Last Post: 12-22-2003, 01:53 PM
  5. No one can seem to help me, loading bitmap
    By Shadow12345 in forum C++ Programming
    Replies: 7
    Last Post: 12-28-2002, 01:22 PM

Tags for this Thread