Makefile on Win 64

4.7k Views Asked by At

I am working on Windows 64 and we need a makefile for our project. We have an existing makefile foe Win 32 and don’t know how to set the 64 bit environment from make file.
If anyone did it or have any sample makefile of Win 64 then please share with me. We are getting the following error

c:\program files (x86)\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(17) : error C2371: 'size_t' : redefinition; d
ifferent basic types
        predefined C++ types (compiler internal)(19) : see declaration of 'size_t'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(81) : fatal error C1189: #error :  "No Target Architecture"
make[3]: *** [shared/anonObject.o] Error 2

which is mainly came when in VS x64 bit configuration is not set.

2

There are 2 best solutions below

1
On BEST ANSWER

I set the 64 bit environment on command prompt then ran the makefile with /MACHINE:X64 option.

1
On

That error (No Target Architecture) is thrown by the preprocessor if neither _AMD64_ nor _IA64_ are defined, which, I believe, either hints you set the target architecture incorrectly (should be done passing /MACHINE:X64 to cl), or you are working with a really exotic one...

I don't know about any other specialties concerning 64-bit compliation, except, of course, you need to run the 64-bit version of cl (the one in VC\bin\amd64).

For that matter, also remember to link using the 64-bit libs instead of the 32-bit ones. They can be found in their respective lib\x64 (Windows SDK) and lib\amd64 (Visual Studio) folders.


The fact that size_t is already defined can probably be fixed using

#define _SIZE_T_DEFINED

before including sourceannotations.h. Are you defining size_t by yourself? It's done in windows.h, which should define the above automatically.