Pelles C forum

C language => Beginner questions => Topic started by: juice on June 19, 2012, 07:26:07 PM

Title: error: "No target architecture"
Post by: juice on June 19, 2012, 07:26:07 PM
Why does the following code produce error under pelles C?? It works fine with MSVC 2010..

#include<winnt.h>
#include<windows.h>
#include<stdlib.h>
#include<stdio.h>

int main()
{
FILE *fp;
IMAGE_DOS_HEADER imdh;
IMAGE_NT_HEADERS imnth;

if((fp = fopen("c:\\le.exe","r"))==NULL)
{
printf("Unable to open file\n");
exit(0);
}

fread(&imdh,sizeof(imdh),1,fp);
fseek(fp,imdh.e_lfanew,SEEK_SET);
}
Title: Re: error: "No target architecture"
Post by: Vortex on June 19, 2012, 08:17:17 PM
Did you use the project wizard to create a console project?
Title: Re: error: "No target architecture"
Post by: TimoVJL on June 19, 2012, 08:23:53 PM
In poide Project -> Project options ... -> Compiler -> Enable Microsoft extensions
Use -Ze option in pocc.exe commandline
Title: Re: error: "No target architecture"
Post by: juice on June 19, 2012, 08:34:25 PM
Quote from: timovjl on June 19, 2012, 08:23:53 PM
In poide Project -> Project options ... -> Compiler -> Enable Microsoft extensions
Use -Ze option in pocc.exe commandline

I enabled Microsoft extensions and the count of errrors exceeded 100..
Title: Re: error: "No target architecture"
Post by: TimoVJL on June 19, 2012, 08:43:54 PM
Take that #include<winnt.h> away
Title: Re: error: "No target architecture"
Post by: Vortex on June 19, 2012, 08:47:25 PM
Hi juice,

You should also take care of imnth. It's not used in your souce code.