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

Everything else that doesn't fall into one of the other PB categories.
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

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

Post 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 ?
A+
Denis
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Use the /I path in commandline

or use the povars32.bat to set the environment
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post 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%
A+
Denis
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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"
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post 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
A+
Denis
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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:
Windows 7 & PureBasic 4.4
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

milan1612

i will try this afternoon.
Tks
A+
Denis
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

Ok ts-soft

Tks
A+
Denis
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5709
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post 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:
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
skywalk
Addict
Addict
Posts: 4316
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

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

Post 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")
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply