Thread: Resources in Dev C++

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    102

    Resources in Dev C++

    Hey all I'm having a hard time understanding how to use resources in dev C++.
    I'm trying to create a nice windows application with menus defined in the resource, however I keep getting the compile error.

    Code:
    make.exe -f "C:\Users\JohnJr\Desktop\Makefile.win" all
    windres.exe -i Windows_private.rc --input-format=rc -o Windows_private.res -O coff 
    
    gcc: installation problem, cannot exec `cc1': No such file or directory
    
    windres.exe: no resources
    Can anyone explain how to use resources in Dev?
    My Favorite Programming Line:
    Code:
    #define true ((rand() % 2) ? true : false)

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Toolbar, goto Project, add resource file. That's it, really. If you've already tried to add the resource file another way (ie. add to project), you're best off just beginning a new project and then adding the files correctly.
    Last edited by Oldman47; 08-26-2007 at 10:34 AM. Reason: Because I felt like it. <sticks out tongue>

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    102
    Actually it's already added. Which is part of the problem, It's in the project if I go to project/project options/files, it displays the resource. I added it when i created the (New/resource) it asked 'Would you like to add file to project' and I said yes.
    My Favorite Programming Line:
    Code:
    #define true ((rand() % 2) ? true : false)

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Put aside your current project, then as a test, do what's below:

    Open Dev
    Goto, File/New/Project
    Select Windows App
    Save 'Project 1' when prompted
    Goto Project, Add Resource file (example below, just rename a wav file to satisfy parameter - what's below is your actual innards for the rc file)

    Add #define ID_SOUND1 100 //add to main.c file, just below include windows.h

    Code:
    #define APSTUDIO_READONLY_SYMBOLS
    
    #ifndef __BORLANDC__
    #include "winresrc.h"
    #endif
    
    
    #undef APSTUDIO_READONLY_SYMBOLS
    
    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
    #ifdef _WIN32
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
    #pragma code_page(1252)
    #endif 
    
    ID_SOUND1               WAVE     DISCARDABLE     "clickme.wav"
    
    
    #endif    
    #ifndef APSTUDIO_INVOKED
    
    #endif
    That should compile without problems, provided you've placed a wav file named 'clickme' in directory that your project files are residing. I'm not particular grand at explaining things, so that example is about the best I can do....

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    102
    well, only problem is that I don't have a project/add resource menu, I have project/Add file, New file(I used for first resource), Remove from project, Project options.
    My Favorite Programming Line:
    Code:
    #define true ((rand() % 2) ? true : false)

  6. #6
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Which version? 4.97?

    By description, it sounds as if you're using the project window [left side of Ide] instead of using the toolbar items.

    You should see; file | edit | search | view | project | execute | et cetera.

    If you select 'project, the dropdown menu should have a listing for 'add resource file'

  7. #7
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by Oldman47 View Post
    Put aside your current project, then as a test, do what's below:

    Open Dev
    Goto, File/New/Project
    Select Windows App
    Save 'Project 1' when prompted
    Goto Project, Add Resource file (example below, just rename a wav file to satisfy parameter - what's below is your actual innards for the rc file)

    Add #define ID_SOUND1 100 //add to main.c file, just below include windows.h

    Code:
    #define APSTUDIO_READONLY_SYMBOLS
    
    #ifndef __BORLANDC__
    #include "winresrc.h"
    #endif
    
    
    #undef APSTUDIO_READONLY_SYMBOLS
    
    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
    #ifdef _WIN32
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
    #pragma code_page(1252)
    #endif 
    
    ID_SOUND1               WAVE     DISCARDABLE     "clickme.wav"
    
    
    #endif    
    #ifndef APSTUDIO_INVOKED
    
    #endif
    That should compile without problems, provided you've placed a wav file named 'clickme' in directory that your project files are residing. I'm not particular grand at explaining things, so that example is about the best I can do....
    Could just do it like this... instead of using a copy-paste MFC resource file.
    Code:
    ID_SOUND1               WAVE     DISCARDABLE     "clickme.wav"
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Yeah, I just copied n' pasted the 1st resource file I came across, call me ignorantly lazy.

    Technically, I could have just suggested compiling a c++ hello world in lieu of a stock window since it was but a compiling example.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 05:35 PM
  2. online resources for win dev?
    By ItalianStallion in forum Windows Programming
    Replies: 2
    Last Post: 07-26-2005, 10:09 AM
  3. Resources with Dev C++ Problem (many simple problems)
    By Zeusbwr in forum Windows Programming
    Replies: 4
    Last Post: 04-06-2005, 11:08 PM
  4. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  5. Storing resources into a single file
    By LuckY in forum Game Programming
    Replies: 20
    Last Post: 08-14-2004, 11:28 PM