Pelles C forum
C language => Windows questions => Topic started by: Akko on September 20, 2018, 11:24:05 PM
-
Why won't the simple console program below compile with Pelles C?
It compiles and runs flawless with gcc and clang.
With Pelles C I get either "No target architecture" or "unresolved WinMain".
Anyhow it is a console program, so I shouldn't need WinMain at all IMHO.
// --- Set console cursor to {10,10}
#include <stdio.h>
#define _CONSOLE
#include <windows.h>
void atxy(int x, int y) {
HANDLE hStdout;
COORD coord;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
coord.Y = y, coord.X = x;
SetConsoleCursorPosition(hStdout,coord); }
int main (void) {
atxy(10,10);
return 0; }
-
Try
Project>Options>Compiler tab>Enable Microsoft extensions
-
That did it. Thank you :)
I am wondering why this /Ze option is there at all.
Pelles C runs on Windows only anyhow AFAIK.
It should not blow up the exe... but perhaps it affects compilation time....
-
PellesC is a C99/C17 compiler.
-Ze option is there as Microsoft Extensions for Windows programs and needed for Windows specific headers.
An additions like:
__stdcall calling convention.
__declspec( dllimport ) __declspec( dllexport ) for dlls.
...
In help-file is a long list of those additions.
For faster compiling define WIN32_LEAN_AND_MEAN before windows.h or in compiler option (-D) define symbols in a project file.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>