Page 1 of 1

rc file syntax problem with #include <windows.h>

Posted: Sun Jun 07, 2009 3:50 pm
by Denis
I have a rc file with first
#include <windows.h>
as explain in PellesC doc

But when i compile the file, i get this error : can't find include file windows.h

I changed <windows.h> with this (PellesC path)

Code: Select all

#include "C:\\Program Files\\PellesC\\Include\\Win\\windows.h"
But when i compile the file, i get this error:
C:\\Program Files\\PellesC\\Include\\Win\\windows.h(10): fatal error : can't find include file sdkddkver.h

In line 10 of windows.h, there is

Code: Select all

#include <sdkddkver.h>
Exactly the same problem

Both windows.h and sdkddkver.h are in the same folder ( C:\\Program Files\\PellesC\\Include\\Win\\)

How to avoid this Porc error ?

Posted: Sun Jun 07, 2009 4:15 pm
by ts-soft
Use the /I path in commandline

or use the povars32.bat to set the environment

Posted: Sun Jun 07, 2009 6:55 pm
by Denis
Tks ts-soft for help, but it still not working.

May be i have a syntax problem with /I option.

povars32.bat seems to be correct but i'm not a dos Guru.

Code: Select all

@echo off
set PellesCDir=C:\Program Files\PellesC
rem
echo Setting 32-bit environment for Pelles C...
rem
set PATH=%PellesCDir%\Bin;%PATH%
set INCLUDE=%PellesCDir%\Include;%PellesCDir%\Include\Win;%INCLUDE%
set LIB=%PellesCDir%\Lib;%PellesCDir%\Lib\Win;%LIB%

Posted: Sun Jun 07, 2009 7:12 pm
by ts-soft
test.bat wrote:@echo off
set PellesCDir=C:\Program Files\PellesC
rem
echo Setting 32-bit environment for Pelles C...
rem
set PATH=%PellesCDir%\Bin;%PATH%
set INCLUDE=%PellesCDir%\Include;%PellesCDir%\Include\Win;%INCLUDE%
set LIB=%PellesCDir%\Lib;%PellesCDir%\Lib\Win;%LIB%

porc "e:\Dateien\PureBasic\MeineProjekte\jaCommander\icons\icons.rc"

Posted: Mon Jun 08, 2009 5:52 am
by Denis
ts-soft,
i try many ways but without succes.

The problem is that PB use Porc.exe in PB folder, not PellesC folder.
Even with PB Compiler Path (porc.exe is in this folder) inside my rc file, nothing run.

I'm really tired of that, i've spend many hours on this pb.


Tks ts-soft

Posted: Mon Jun 08, 2009 10:14 am
by milan1612
I just successfully compiled a resource file with porc that includes windows.h among others.

If you have installed Pelles C, then just go to your Startmenu, choose Pelles C for Windows
and run Pelles C Command Prompt. Then switch to the folder where your resource script
lies and execute "porc file.rc". That's it, if this doesn't work then something is really broken... :wink:

Posted: Mon Jun 08, 2009 10:47 am
by Denis
milan1612

i will try this afternoon.
Tks

Posted: Mon Jun 08, 2009 2:57 pm
by ts-soft
Another way, without Commandline :wink:

Code: Select all

EnableExplicit

Prototype.i PORC_compile_script(InputFile.s, OutPutFile.s = "")
Prototype.i PORC_add_include_path(IncPath.s)

Define.i PORC_DLL

Procedure PORC_Init(DLLPath.s = "")
  Shared PORC_DLL
  
  If Not DLLPath
    DLLPath = #PB_Compiler_Home + "Compilers\porc.dll"
  EndIf
  
  PORC_DLL = OpenLibrary(#PB_Any, DLLPath)
  
  If PORC_DLL
    Global PORC_Compile.PORC_compile_script = GetFunction(PORC_DLL, "_compile_script@8")
    Global PORC_AddIncludePath.PORC_add_include_path =  GetFunction(PORC_DLL, "_add_include_path@4")
    ProcedureReturn PORC_DLL
  EndIf
EndProcedure


Procedure PORC_Free()
  Shared PORC_DLL
  
  If PORC_DLL
    CloseLibrary(PORC_DLL)
    PORC_Compile = 0
    PORC_AddIncludePath = 0
    PORC_DLL = 0
  EndIf
EndProcedure

If PORC_Init()
  PORC_AddIncludePath("c:\Program Files\PellesC\Include\Win\")
  PORC_Compile("myres.rc")
  PORC_Free()
EndIf

Posted: Tue Jun 09, 2009 5:27 pm
by Denis
Ok ts-soft

Tks

Posted: Thu Aug 27, 2009 3:52 pm
by Kwai chang caine
ts-soft wrote:Another way, without Commandline :wink:

Code: Select all

EnableExplicit

Prototype.i PORC_compile_script(InputFile.s, OutPutFile.s = "")
Prototype.i PORC_add_include_path(IncPath.s)

Define.i PORC_DLL

Procedure PORC_Init(DLLPath.s = "")
  Shared PORC_DLL
  
  If Not DLLPath
    DLLPath = #PB_Compiler_Home + "Compilers\porc.dll"
  EndIf
  
  PORC_DLL = OpenLibrary(#PB_Any, DLLPath)
  
  If PORC_DLL
    Global PORC_Compile.PORC_compile_script = GetFunction(PORC_DLL, "_compile_script@8")
    Global PORC_AddIncludePath.PORC_add_include_path =  GetFunction(PORC_DLL, "_add_include_path@4")
    ProcedureReturn PORC_DLL
  EndIf
EndProcedure


Procedure PORC_Free()
  Shared PORC_DLL
  
  If PORC_DLL
    CloseLibrary(PORC_DLL)
    PORC_Compile = 0
    PORC_AddIncludePath = 0
    PORC_DLL = 0
  EndIf
EndProcedure

If PORC_Init()
  PORC_AddIncludePath("c:\Program Files\PellesC\Include\Win")
  PORC_Compile("myres.rc")
  PORC_Free()
EndIf
Can i use this code to compile a simple RC file with PORC ??? :roll:
Because i have tried it, and obviously ...that don't works :cry:

Re: rc file syntax problem with #include <windows.h>

Posted: Fri Jan 03, 2014 4:17 am
by skywalk
Thanks ts-soft!

Code: Select all

    ; updated porc.dll exports in PBv521 compilers folder.
    Global PORC_compile.PORC_compile_script          = GetFunction(PORC_DLL, "_compile_script_w@8")
    Global PORC_addincludepath.PORC_add_include_path = GetFunction(PORC_DLL, "_add_include_path_w@4")