当我在VS2010中将项目升级到64位时,它为所提到的代码行提供了低于2的编译器错误:
RC1116:RC在预处理器错误后终止
RC2021:期望的指数值,而不是' 6'。
<form role="form" novalidate>
<h2>Please Sign Up</h2>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" class="form-control input-lg" name="fname" ng-model="registerViewModel.first_name" placeholder="First Name" tabindex="1" required="" />
<div ng-show="form.fname.$touched">
<div ng-show="form.fname.$error.required">Tell us your name</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" class="form-control input-lg" ng-model="registerViewModel.last_name" placeholder="Last Name" tabindex="2">
</div>
</div>
</div>
<div class="form-group">
<input type="email" class="form-control input-lg" ng-model="registerViewModel.email" placeholder="Email Address" ng-model="email" tabindex="4">
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="password" class="form-control input-lg" ng-model="registerViewModel.password" placeholder="Password" tabindex="5">
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="password" class="form-control input-lg" ng-model="registerViewModel.confirmPassword" placeholder="Confirm Password" tabindex="6">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-8 col-sm-9 col-md-9">
By clicking <strong class="label label-primary">Register</strong>, you agree to the <a href="#" data-toggle="modal" data-target="#t_and_c_m">Terms and Conditions</a> set out by this site, including our Cookie Use.
</div>
</div>
<hr class="colorgraph">
<div class="row">
<div class="col-xs-12 col-md-6"><input type="button" ng-click="adminRegister.registrationRequest()" value="Register" class="btn btn-primary btn-block btn-lg" tabindex="7"></div>
</div>
</form>
有人可以建议我如何解决这个问题?这段代码在VC ++。Net 2003中完美编译。
答案 0 :(得分:0)
错误号和消息中的“RC”前缀是一个很大的线索。不是C ++编译器绊倒了这段代码,而是resource compiler。
资源编译器甚至不了解整个C语言。它有一个最小的预处理器,可以进行常量替换。它不理解变量声明,如:
const float AXIS_WIDTH = 2E6F; // invalid for resource compiler
const float AXIS_HEIGHT = 2.0; // invalid for resource compiler
const int THE_ANSWER = 42; // invalid for resource compiler
它唯一理解的是宏:
#define THE_ANSWER 42
很好,所以现在唯一的问题是,为什么这是由资源编译器编译的。我假设你知道你是否在项目的资源(.rc)文件中输入它,所以我最好的猜测是你在resource.h
文件中有它,它被包含在资源文件中(反过来,由资源编译器编译。
将此常量声明移动到另一个头文件中,一个不包含在项目的资源文件中。它可以在所有版本的C ++编译器中正常工作,就像Simon et al。所说的那样。无论如何,浮点值在资源文件中没什么用处。