User forums => Using Code::Blocks => Topic started by: allergencore on November 04, 2011, 09:32:23 am

Title: resource compiler error
Post by: allergencore on November 04, 2011, 09:32:23 am
OS = Win7 x64
CB Version = Code::Blocks 10.05 rev 6283
Compiler = minGW GCC 4.1.1

build log:
Code: [Select]
-------------- Build: Debug in dll_1_test ---------------

Compiling: main.rc
windres.exe: C:\\Users\\cache\\DOCUME~1\\7B76~1\\CODE_B~1\\DLL_1_~1\\main.rc:1: syntax error
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

I've added main.rc(it's identical to example (
resource compiler always notify me on lines LANGUAGE, FILEOS, FILETYPE, FILESUBTYPE that syntax is wrong or preprocessing failed
Code: [Select]
  FILEVERSION      1,0,0,1
#ifdef _DEBUG
  FILEFLAGS        0x0L  // final version
  FILESUBTYPE      VFT2_UNKNOWN // not used
  BLOCK "StringFileInfo"
    BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
      VALUE "Build",            "August 2007\0"
      VALUE "Comments",         "Free for personal use only.\0"
      VALUE "CompanyName",      "Fake Company\0"
      VALUE "Developer",        "The Developer\0"
      VALUE "FileDescription",  "Application implementing something\0"
      VALUE "FileVersion",      "1.0.000\0"
      VALUE "InternalName",     "AppInternalName\0"
      VALUE "LegalCopyright",   "Copyright (C) 2007 Fake Company\0"
      VALUE "LegalTrademarks",  "All rights reserved.\0"
      VALUE "OriginalFilename", "TheEXE.exe\0"
      VALUE "PrivateBuild",     "\0"
      VALUE "ProductName",      "The EXE\0"
      VALUE "ProductVersion",   "1.0.000\0"
      VALUE "SpecialBuild",     "\0"
      VALUE "Support",          "TheEXE at\0"
      VALUE "Users",            "Unlimited.\0"
    } // BLOCK "040904E4"
  } // BLOCK "StringFileInfo"
  BLOCK "VarFileInfo"
    VALUE "Translation", 0x409, 1252 // 1252 = 0x04E4
  } // BLOCK "VarFileInfo"

Code: [Select]
#ifndef __MAIN_H__
#define __MAIN_H__

#include <windows.h>

/*  To use this exported function of dll, include this header
 *  in your project.

#ifdef BUILD_DLL
    #define DLL_EXPORT __declspec(dllexport)
    #define DLL_EXPORT __declspec(dllimport)

#ifdef __cplusplus
extern "C"

void DLL_EXPORT SomeFunction(const LPCSTR sometext);

#ifdef __cplusplus

#endif // __MAIN_H__

Code: [Select]
#include "main.h"

// a sample exported function
void DLL_EXPORT SomeFunction(const LPCSTR sometext)
    MessageBoxA(0, sometext, "DLL Message", MB_OK | MB_ICONINFORMATION);

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    switch (fdwReason)
        case DLL_PROCESS_ATTACH:
            // attach to process
            // return FALSE to fail DLL load

        case DLL_PROCESS_DETACH:
            // detach from process

        case DLL_THREAD_ATTACH:
            // attach to thread

        case DLL_THREAD_DETACH:
            // detach from thread
    return TRUE; // succesful
please help me, i'm dummy in resource compiling and windows programming.
project - i'm trying to compile and use dll
Title: Re: resource compiler error
Post by: zabzonk on November 04, 2011, 10:16:18 am
You need to include windows.h:

Code: [Select]
#include <windows.h>
// rest of resource file

Not related, but can I just point out that names like this:

Code: [Select]


are illegal in user code. All names that begin with two underscores or with an underscore and an uppercase letter are reserved for the C/C++ implementation at all scopes.
Title: Re: resource compiler error
Post by: allergencore on November 04, 2011, 10:30:48 am
thanks a lot! inclusion of windows.h solved my problem  :D
__MAIN_H__ works correctly too.... i don't know  :?