Hi Ron,
Yes, that is not supported by MSVC. I try to compile a dummy file with
the following contents:
wang_x1@pc7149 /c/test
$ cat test.c
#if #cpu(i386)
#error CPU i386 asserted
#endif
wang_x1@pc7149 /c/test
$ cl test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.c
test.c(1) : error C2014: preprocessor command must start as first
nonwhite space
test.c(1) : fatal error C1017: invalid integer constant expression
Probably removing completely is not necessary. It does not harm if it is
put after checking _WIN32,
because MSVC will not contiue further. This was the case in motor 6-3
release.
#if defined(_WIN32) || defined (_M_IX86) || defined (_X86_)
#define LSB_First (TRUE) /* LSB is packed first. */
#elif #cpu(i386)
#define LSB_First (TRUE) /* LSB is packed first. */ It seems MSVC
Best,
Xiaoqiang
-----Original Message-----
From: Ron Sluiter [mailto:[email protected]]
Sent: Monday, April 20, 2009 4:22 PM
To: Wang Xiaoqiang
Cc: epics
Subject: Re: Motor record compilation error under win32-x86
Hello Wang,
I am guessing that it is the preprocessor assertions (e.g., #cpu(i386))
that are not supported by MSVC.
I suggest you test this by removing them from the file (motor.h) and
recompiling. The preprocessor variables MSB_First and LSB_First may not
be correct, but at least we will know what exactly is not supported.
Ron
Wang Xiaoqiang wrote:
Hi,
When I compile motor 6-4-2 under win32-x86 with vs2008 (cl version
14.00.50727.762), it reports the following errors:
make[1]: Entering directory
`/c/epics/synApps_5_4/support/motor/6-4-2/motorApp/MotorSrc/O.win32-x86'
Installing generic include file ../../../include/motor.h
cl /nologo /EHsc /GR -c /D_CRT_SECURE_NO_DEPRECATE
/D_CRT_NONSTDC_NO_DEPRECATE /D__STDC__=0 /Ox /GL /W3 /w44355
/MT -DEPICS_DLL_NO -I. -I..\\O.Common -I. -I..
-I..\\..\\..\\include\\os\\WIN32 -I..\\..\\..\\include
-Ic:\\epics\\synApps_5_4\\support\\asyn\\4-10\\include
-Ic:\\epics\\synApps_5_4\\support\\seq\\2-0-12\\include
-Ic:\\epics\\base-3.14.10\\include\\os\\WIN32
-Ic:\\epics\\base-3.14.10\\include
-Ic:\\epics\\synApps_5_4\\support\\motor\\6-4-2\\include /Tp
..\\motorRecord.cc
motorRecord.cc
c:\epics\synapps_5_4\support\motor\6-4-2\motorapp\motorsrc\motor.h(126
)
: error C2014: preprocessor command must start as first nonwhite space
c:\epics\synapps_5_4\support\motor\6-4-2\motorapp\motorsrc\motor.h(126
)
: fatal error C1017: invalid integer constant expression
make[1]: *** [motorRecord.obj] Error 2
make[1]: Leaving directory
`/c/epics/synApps_5_4/support/motor/6-4-2/motorApp/MotorSrc/O.win32-x86'
make: *** [install.win32-x86] Error 2
In motor.h(126): #if defined(_WIN32) || #cpu(i386) || defined
(_M_IX86)
|| defined (_X86_),
the #cpu(i386) assertion confuses compiler. If I split it over two
lines then it works.
#if defined(_WIN32) || defined (_M_IX86) || defined (_X86_)
#define LSB_First (TRUE) /* LSB is packed first. */ #elif
#cpu(i386)
#define LSB_First (TRUE) /* LSB is packed first. */ It seems MSVC
does not accept directives mixed.
--
Dr. Xiaoqiang Wang
Paul Scherrer Institut, WBGB/010
5232 Villigen PSI, Switzerland