Thread: adding resource files to .exe in Dev c++

  1. #1
    Registered User
    Join Date
    Oct 2016
    Posts
    4

    adding resource files to .exe in Dev c++

    hey guys i am fairly new to Programming so simple is better. i have a console application that i need to add resource files to in Dev c++ 5.11. I have already added the .wav file to my project i have checked include with compilation. but still as soon as i take my .exe file out of the folder where i have my .wav file in it does not play the sound. any ideas im pulling my hair out at this point it should not be this difficult to add a resource file to my program. thanks in advance

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Why are you moving the .exe file? If you move it then you need to tell the linker
    where the file is - possibly with a stream. Have you tried using the dev packs
    help files? I'm guessing your using a third party library to play audio. Technically
    you should keep all execution files together in the same folder - unless you have
    a good reason to move things around.
    Double Helix STL

  3. #3
    Registered User
    Join Date
    Oct 2016
    Posts
    4
    I am moving the. Exe becuase I'm trying to distribute the program, in other words all I'm trying to do is have the music files included shipped with the .exe(I think it's called embedded files).

  4. #4
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    Make a little file in Notepad with the following and save it as mywave.rc:
    Code:
    MYWAVE  WAVE  "awavefile.wav"
    "awavefile.wav" is your wave file; MYWAVE the associated identifier and can be whatever you want.

    Add mywave.rc to your project. The IDE should automatically compile the resource into the exe.

    Play it like
    Code:
    PlaySound("MYWAVE", GetModuleHandle(NULL), SND_RESOURCE);
    PlaySound function

    Playing Wave Resources
    Last edited by algorism; 10-02-2016 at 10:14 AM.

  5. #5
    Registered User
    Join Date
    Oct 2016
    Posts
    4
    i did that now im getting this error.
    $(WINDRES) -i gummybears_private.rc --input-format=rc -o gummybears_private.res -O coff --include-dir C:/Users/brian/Desktop/GUMMYB~1

    any additional ideas?

    it also says this.
    32 C:\Users\brian\Desktop\gummybears\Makefile.win recipe for target 'gummybears_private.res' failed


    it also says this.
    C:\Users\brian\Desktop\gummybears\can't open file `85568__joelaudio__dragon-roar (2)' No such file or directory


    this is my makefile.
    # Project: gummybears
    # Makefile created by Dev-C++ 5.11


    CPP = g++.exe
    CC = gcc.exe
    WINDRES = windres.exe
    RES = gummybears_private.res
    OBJ = main.o $(RES)
    LINKOBJ = main.o $(RES)
    LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -lwinmm mywave.res
    INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
    CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
    BIN = gummybears.exe
    CXXFLAGS = $(CXXINCS) -std=c++11
    CFLAGS = $(INCS) -std=c++11
    RM = rm.exe -f


    .PHONY: all all-before all-after clean clean-custom


    all: all-before $(BIN) all-after


    clean: clean-custom
    ${RM} $(OBJ) $(BIN)


    $(BIN): $(OBJ)
    $(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)


    main.o: main.cpp
    $(CPP) -c main.cpp -o main.o $(CXXFLAGS)


    gummybears_private.res: gummybears_private.rc mywave.res
    $(WINDRES) -i gummybears_private.rc --input-format=rc -o gummybears_private.res -O coff --include-dir C:/Users/brian/Desktop/GUMMYB~1
    Last edited by brink1123; 10-02-2016 at 05:01 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. VS2010 Adding a file as a binary resource
    By gman64 in forum Windows Programming
    Replies: 0
    Last Post: 03-07-2013, 06:27 AM
  2. Adding resource file (.rc)
    By alphaoide in forum C++ Programming
    Replies: 0
    Last Post: 11-13-2003, 09:04 AM
  3. Adding menu resource to the window... HELP!!!
    By DeSeis in forum Windows Programming
    Replies: 6
    Last Post: 05-14-2002, 01:52 PM
  4. Adding bitmap as a resource for texture mapping in OpenGL
    By Unregistered in forum Game Programming
    Replies: 2
    Last Post: 03-03-2002, 02:03 PM

Tags for this Thread