Author Topic: Resources with code blocks  (Read 19920 times)

chrishowarth

  • Guest
Resources with code blocks
« on: April 19, 2007, 02:17:14 pm »
Hello ~ my first post!! :D

I've just downloaded the Code::Blocks IDE, and I was wondering how to use resource (.rc) files with it?  I had to delete the one already included with my Dev-cpp project, as I got the error while compiling it in Code::Blocks... oh, I've forgotten.  I'm not on my computer.  A 'Win something.exe' errors.  But anyway, I haven't been able to find any support for them yet.  Prove me wrong!  Is there anything that I can do?

~ Christopher Howarth

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Resources with code blocks
« Reply #1 on: April 19, 2007, 02:27:01 pm »
Yes, Code::Blocks has full support for using .rc files!

Enable full command line logging (Settings->Compiler and debugger->Global compiler settings->Other->Compiler logging), and post the contents of the Build Log here.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

chrishowarth

  • Guest
Re: Resources with code blocks
« Reply #2 on: April 19, 2007, 05:16:46 pm »
I think this is it?  After I had done what you asked I re-added the resource, attempted to build, and copied to contents of the 'Build Log' tab.  Is this correct?  If it is, here is what I got:

Quote
Project   : main
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Christopher\My Documents\Christopher's Stuff\Personal\C++\My Projects\Win32 Code Blocks\
--------------------------------------------------------------------------------
Switching to target: default
windres.exe -i about.rc -J rc -o .objs\about.res -O coff   
windres.exe: about.rc:2: syntax error
Process terminated with status 1 (0 minutes, 1 seconds)

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Resources with code blocks
« Reply #3 on: April 19, 2007, 05:38:57 pm »
It's telling you there's an error in the syntax on line two of your resource file. Let's see that line and its immediate context.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

chrishowarth

  • Guest
Re: Resources with code blocks
« Reply #4 on: April 19, 2007, 05:42:42 pm »
OK - Oh, and by the way, I tried another resource file, and got an error.  Code::Blocks also didn't recognisr the file extention and asked me how to open it.  The resource file syntax was taken from a WinAPI tutorial website.

Code
ABOUTDLG DIALOG 0, 0, 155, 102
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About Elixir ID3 Editor"
FONT 8, "MS Sans Serif"
{
   CONTROL "&OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 6, 83, 50, 14
   CONTROL "&Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 95, 83, 50, 14
   CONTROL "About This Program", -1, "button", BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 144, 73
   CONTROL "© 2007 by Christopher Howarth, Elixir Software.\n\nNote: This application was created in pure C/C++, and is open source. ", -1, "static", SS_CENTER | WS_CHILD | WS_VISIBLE, 10, 27, 120, 50
}

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Resources with code blocks
« Reply #5 on: April 19, 2007, 05:48:23 pm »
Code::Blocks also didn't recognisr the file extention and asked me how to open it.
Just tell it to open it in the Code::Blocks editor, and it'll never ask you again.

As far as the code you posted, all you should need to do is add the following line to the top:
Code
#include <windows.h>
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

chrishowarth

  • Guest
Re: Resources with code blocks
« Reply #6 on: April 19, 2007, 06:06:43 pm »
It works!!!  Thankyou!  Silly me, I forgot all about that...  :o