Author Topic: resource compiler error  (Read 3206 times)

Offline allergencore

  • Single posting newcomer
  • *
  • Posts: 2
resource compiler error
« 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 http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)&oldid=6943)
resource compiler always notify me on lines LANGUAGE, FILEOS, FILETYPE, FILESUBTYPE that syntax is wrong or preprocessing failed
main.rc:
Code: [Select]
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO    VERSIONINFO
  FILEVERSION      1,0,0,1
  PRODUCTVERSION   1,0,0,1
  FILEFLAGSMASK    0x3fL // VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
  FILEFLAGS        0x1L  // VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
#else
  FILEFLAGS        0x0L  // final version
#endif
  FILEOS           VOS_NT_WINDOWS32
  FILETYPE         VFT_DLL
  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 fake-domain.com\0"
      VALUE "Users",            "Unlimited.\0"
    } // BLOCK "040904E4"
  } // BLOCK "StringFileInfo"
  BLOCK "VarFileInfo"
  {
    VALUE "Translation", 0x409, 1252 // 1252 = 0x04E4
  } // BLOCK "VarFileInfo"
}

main.h
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)
#else
    #define DLL_EXPORT __declspec(dllimport)
#endif


#ifdef __cplusplus
extern "C"
{
#endif

void DLL_EXPORT SomeFunction(const LPCSTR sometext);

#ifdef __cplusplus
}
#endif

#endif // __MAIN_H__

main.cpp
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
            break;

        case DLL_PROCESS_DETACH:
            // detach from process
            break;

        case DLL_THREAD_ATTACH:
            // attach to thread
            break;

        case DLL_THREAD_DETACH:
            // detach from thread
            break;
    }
    return TRUE; // succesful
}
please help me, i'm dummy in resource compiling and windows programming.
project - i'm trying to compile and use dll
« Last Edit: November 04, 2011, 09:34:44 am by allergencore »

zabzonk

  • Guest
Re: resource compiler error
« Reply #1 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]

__MAIN_H__


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.
« Last Edit: November 04, 2011, 10:24:53 am by Neil Butterworth »

Offline allergencore

  • Single posting newcomer
  • *
  • Posts: 2
Re: resource compiler error
« Reply #2 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  :?