Hello All!
I wrote a small Hello World! program that of course, displays "Hello World!" to the console screen. Just to tinker a bit I added a few more messages which are separated by a pause function and a clear screen function, the latter of which makes a call to the Windows API and uses the windows.h header. When I compile my app as a 32-bit console program it compiles and works perfectly. However, when I try to build it as a 64-bit console app I get the following errors:
====================================================================================
Building tutorial_03.obj.
C:\Program Files\PellesC\Include\Win\winnt.h(9034): warning #1001: Unterminated #if/#ifdef/#ifndef in #include file.
C:\Program Files\PellesC\Include\Win\winbase.h(258): error #2048: Undeclared identifier 'RTL_CRITICAL_SECTION' (did you mean 'LPFILETIME'?).
C:\Program Files\PellesC\Include\Win\winbase.h(259): error #2048: Undeclared identifier 'PRTL_CRITICAL_SECTION' (did you mean 'CRITICAL_SECTION'?).
C:\Program Files\PellesC\Include\Win\winbase.h(260): error #2048: Undeclared identifier 'PRTL_CRITICAL_SECTION' (did you mean 'PCRITICAL_SECTION'?).
C:\Program Files\PellesC\Include\Win\winbase.h(262): error #2048: Undeclared identifier 'RTL_CRITICAL_SECTION_DEBUG' (did you mean 'LPCRITICAL_SECTION'?).
C:\Program Files\PellesC\Include\Win\winbase.h(263): error #2048: Undeclared identifier 'PRTL_CRITICAL_SECTION_DEBUG' (did you mean 'CRITICAL_SECTION_DEBUG'?).
C:\Program Files\PellesC\Include\Win\winbase.h(264): error #2048: Undeclared identifier 'PRTL_CRITICAL_SECTION_DEBUG' (did you mean 'PCRITICAL_SECTION_DEBUG'?).
C:\Program Files\PellesC\Include\Win\winbase.h(268): error #2048: Undeclared identifier 'RTL_RUN_ONCE' (did you mean 'LPRECT'?).
C:\Program Files\PellesC\Include\Win\winbase.h(269): error #2048: Undeclared identifier 'PRTL_RUN_ONCE' (did you mean 'INIT_ONCE'?).
C:\Program Files\PellesC\Include\Win\winbase.h(270): error #2048: Undeclared identifier 'PRTL_RUN_ONCE' (did you mean 'PINIT_ONCE'?).
C:\Program Files\PellesC\Include\Win\winbase.h(292): error #2048: Undeclared identifier 'RTL_SRWLOCK' (did you mean 'LPCRECT'?).
C:\Program Files\PellesC\Include\Win\winbase.h(301): error #2048: Undeclared identifier 'BOOLEAN' (did you mean 'BOOL'?).
C:\Program Files\PellesC\Include\Win\winbase.h(302): error #2048: Undeclared identifier 'BOOLEAN' (did you mean 'BOOL'?).
C:\Program Files\PellesC\Include\Win\winbase.h(304): error #2048: Undeclared identifier 'RTL_CONDITION_VARIABLE' (did you mean 'LPINIT_ONCE'?).
C:\Program Files\PellesC\Include\Win\winbase.h(650): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\winbase.h(650): error #2001: Syntax error: expected '}' but found 'EXCEPTION_RECORD'.
C:\Program Files\PellesC\Include\Win\winbase.h(650): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\winbase.h(652): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\winbase.h(652): error #2048: Undeclared identifier 'EXCEPTION_DEBUG_INFO' (did you mean 'EXCEPTION_DISPOSITION'?).
C:\Program Files\PellesC\Include\Win\winbase.h(652): error #2001: Syntax error: expected ';' but found ','.
C:\Program Files\PellesC\Include\Win\winbase.h(652): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\winbase.h(710): error #2078: Invalid union field declarations.
C:\Program Files\PellesC\Include\Win\winbase.h(710): error #2001: Syntax error: expected '}' but found 'EXCEPTION_DEBUG_INFO'.
C:\Program Files\PellesC\Include\Win\winbase.h(710): error #2065: Invalid use of incomplete type '(incomplete) union (no name)'.
C:\Program Files\PellesC\Include\Win\winbase.h(711): error #2199: Invalid field declaration after empty field in '(incomplete) struct _DEBUG_EVENT'.
If you are compiling a Windows program, make sure you use the /Ze option!
*** Error code: 1 ***
Done.
====================================================================================
The number of errors is actually over 100. I just shortened them here for space and they all refer to winbase.h. Here is my current congiuration when trying to compile an x64 console app.
COMPILER
------------------------------------------------------------------------------------------
Runtime Library: Single-threaded (LIB)
Calling conv: _fascal (is grayed out and won't let me select a different one)
Machine: x64
Lining: Default
C Standard: C11
Options: Enable Microsoft Extensions = checked\Enable Pelle's C Extensions = checked
CCFLAGS: -std:C11 -Tx64-coff -Ot -Ob1 -fp:precise -W1 -Gd -Ze -Zx
LINKER
------------------------------------------------------------------------------------------
Library and object files: kernel32.lib advapi32.lib delayimp64.lib
Subsystem Type: Console
Machine: x64
My code is insignificant to the error produced. If I have only one line of code such as
printf("Hello World!\n)";
without calling the 'pause' or 'clrscrn' functions and I still get the same errors simply by having #include <windows.h> in my directives and compiling it as an x64 console app. When I compile it as an x86 console app, all works well.
Am I missing a necessary compiler switch or setting somwhere for x64 compilation that I'm not aware of?
Thanks in advance!!!
INFO UPDATE:
I forgot to mention earlier that I'm using the new version 8.00.7 RC3. Is there any chance this might be a minor bug with the pre-defined compiler settings not agreeing with the windows header files supplied with Pelle's C?
I have since tried the exact same code compiled to x64 in Code::Blocks using the MinGW compiler, in C++Builder XE6, and in Visual C++ 2013. It worked flawlessly with all three but I really like Pelle's C a lot better than those, so I want to tried and get this solved ASAP...