关于QT中 **.cpp:1:1: error: stray '\377' in program 错误解决

MSYS2+GCC+CMake:Windows下打造轻量C++开发环境实战 C++作为跨平台语言,其编译器与构建工具链的选择直接影响开发效率。在Windows环境中,许多开发者受困于Visual Studio的臃肿与封闭生态,而MSYS2、GCC与CMake的组合提供了一条轻量、开放的替代路径。MSYS2基于pacman包管理,可一键获取GCC工具链;CMake作为跨平台构建系统,配合Ninja生成器能实现快速增量编译。这套方案不仅占用资源小、启动快,更贴近Linux部署环境,特别适合面向服务器或嵌入式场景的C++工程师。文章围绕MSYS2、GCC和CMake的实战配置,覆盖环境安 阅读详情
AI摘要

本文介绍在Ubuntu系统使用QT Creator开发过程中遇到的UTF-16编码导致的编译错误,并提供了解决方案,即将文件编码改为US-ASCII。

时间:2017年12月4号

环境:ubuntu64 +QT creator

问题描述:

今天在进行编码的时候,不小心将文件编码格式选为:UTF-16格式,搞得一编译全部是下面的错误:

stray '\377'in program

stray '\376'in program

.........

null characters(s) ignored

null characters(s) ignored


我知道应该是文本编码保存的问题,于是网上搜相应的解决办法,文中提及到“这是因为你的编译器将文件编码存为了UTF-8格式的,可是winavr作为gcc的编译器是不认识这种格式的”,“将UTF-8改掉,改成US-ASIIC或者Chinese Simple(GB2312)都行,为什么Chinese Simple(GB2312)也行我也不知道,可能其他的也行只要不是UTF-8就行了”。但是没找到相应qt下的快速解决办法,为此,写这笔记是想在qt creator,如何快速解决这个问题:

下面是解决步骤:

1、打开相应的文件,然后点击菜单栏的编辑(edit)

2、选择select encoding 

3、选择US-ASCII编码模式,再点击按编码重新载入



qt工程编译和运行 1.删掉:Debug、GeneratedFiles、Release、Win32、x64和文件...user、...sln、...vcxproj、......filters 2.只保留:.h、.cpp、.qrc(没有这个文件编译出来的Qt项目会显示不了图片)、.ui文件和Resources目录 3..pro文件文件目的是为了实现跨平台,内容都是配置信息,例如指明头文件所在,库文件所在,库文件名,目标... 阅读详情

相关推荐

编译错误error: stray ‘\343’in program的解决方法

以下是对编译错误error: stray ‘343’in program的解决方法进行了详细的分析介绍,如遇此问题的朋友们可以过来参考下

error: stray '\377' in program

cygwin编译报错:**.cpp:1:1: error: stray '\377' in program解决方法2014-06-12 00:412061人阅读评论(1)收藏举报编译报错内容:[armeabi] Compile++ thumb: cocos2dcpp_shared <= HelloWorldScene.cppjni/../../Classes/H...

weixin_34129696的博客 2106

利用Openlayers4实现地图遮罩效果(二)

之前实现的遮罩效果,在深色背景的底图上,对要突出的区域采用半透明遮罩,以此来突出该区域。但是有时底图颜色偏白,这时候不再适合对要突出的区域采用遮罩,而是要对突出区域之外进行遮罩处理。两种效果的对比入下图: ...

此爱如少年 6404

qt5编译提示stray \377 in program

笔记

qq_43080454的博客 1523

LCD驱动芯片——BL55072A驱动程序

初始化子程序: START 0x7C; I2C子地址 0xEA;ICSET,软件复位芯片 0xC0;MODSET,关显示 0xF0;BLKCTL,关闪烁 0xA3;DISCTL,80Hz Line inversion,High Power mode 0xE8;ICSET,清复位bit1 STOP 显示刷新子程序: START 0x7C;I2C子地址 0xF0;BLKCTL,关闪烁 0xA3;DISCTL,80Hz Line inversion,High Power mode 0xE8或0xEC;ICSE

love421的博客 3179

告别手动点鼠标:用Python脚本批量跑ADS版图仿真,效率提升10倍(附完整代码)

本文详细介绍了如何利用Python脚本自动化ADS版图仿真流程,显著提升射频工程师的工作效率。通过调用ADS底层接口,实现参数化修改、批量任务调度和结果自动收集,解决了手动操作中的常见问题,如仿真不更新等。附完整代码,帮助开发者快速实现10倍效率提升。

weixin_42523543的博客 343

cygwin编译报错:**.cpp:1:1: error: stray '\377' in program解决方法

交叉编译报错 [armeabi] Compile++ thumb: cocos2dcpp_shared jni/../../Classes/HelloWorldScene.cpp:1:1: error: stray '\377' in program jni/../../Classes/HelloWorldScene.cpp:1:1: error: stray '\376' in pr

芒果布丁00的博客 1万+

BUUCTF--[OGeek2019]babyrop

才学习了基本的ROP流程,到处找题练,不过也没做出来几道题,以这道32位的题作为例题吧。 这道题是BUUCTF上pwn练习题里的[OGeek2019]babyrop。 代码审计 老规矩先checksec一下: 没有canary保护,nx保护开启排除shellcode可能性,FULL RELEO为地址随机化。 观察主函数,先设定了一个闹铃,到时间就会强制退出程序,解除闹铃的方法在上一篇博客中提到过了, 这道题中闹铃函数依然对我们解题起不到什么干扰作用。 主函数的思路大概是:生成一个随机数,把这个随机数作为

N1rvana的博客 6014

Qt与OpenCV环境配置全攻略:版本匹配、CMake编译及常见坑解析

在跨平台C++开发中,图形界面框架与计算机视觉库的整合是构建图像处理应用的基础技能。Qt作为成熟的GUI开发框架,负责构建交互界面;OpenCV则提供丰富的图像处理算法接口,二者结合可快速实现从图像读取、处理到界面展示的完整链路。要实现这套组合,核心在于构建工具链的正确配置,包括选择合适的编译器版本、通过CMake生成构建脚本,以及使用MinGW完成源码编译。版本兼容性是整个流程的灵魂,错误的搭配往往导致编译失败或运行时异常。在实际工程中,理解库文件链接、动态库路径配置等原理,能有效应对环境搭建中的各类问题

weixin_34405557的博客 1090

【即插即用模块】Transformer篇 | ICCV 2025 | MALA :注意力分布神似Softmax,告别线性注意力性能短板!

MALA(Magnitude-Aware Linear Attention)是一种改进的线性注意力机制,通过引入缩放因子和偏移项,解决了传统线性注意力忽视查询幅度的问题,使其分布更接近Softmax Attention。该模块具有线性复杂度(O(n)),结合RoPE和LEPE编码实现全局-局部位置信息混合,通过z值调制平衡信息权重。实验表明MALA在轻量级视觉任务中能有效平衡效率与精度,注意力可视化显示其分布与Softmax Attention高度相似。代码提供完整的RoPE位置编码和线性注意力

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 1113

3.1 5分钟搞定!Claude Code接入国产大模型完整教程(附代码)

摘要 本文提供了一份5分钟快速为Claude Code接入国产大模型的完整教程。首先介绍了系统环境要求(Windows/macOS/Linux、Node.js 18+、Python 3.8+),然后详细说明了三种安装Claude Code的方式(npm/yarn/pnpm)。重点讲解了两种国产大模型接入方案:通义千问(推荐)和文心一言,包括获取API密钥、安装SDK、创建MCP服务器、配置Claude Code等步骤。文中提供了详细的代码示例和配置文件模板,确保开发者能快速完成国产大模型的接入,降低使用成本

yonggeit的博客 7935

Linux下编译错误:error: stray ‘\377’ in program

Hello.c:1: error: stray ‘\232’ in programHello.c:1: error: stray ‘\247’ in programHello.c:1: error: stray ‘\360’ in programHello.c:1: error: stray ‘\224’ in programHello.c:1: error: stray ‘\217’ in pr...

feng1028zd的专栏 5114

基于Matlab模拟六自由度Stewart并联机器人运动学逆解

在现代工业和科学领域中,机器人技术的发展已经取得了巨大的进步,为生产和研究提供了许多便利。其中,六自由度Stewart并联机器人是一种广泛应用于各种领域的机器人系统。它具有高精度、高刚度和高可靠性的特点,被广泛应用于飞行模拟器、手术机器人和运动仿真等领域。然而,要使Stewart并联机器人能够实现复杂的运动任务,我们需要了解其运动学逆解。运动学逆解是指根据机器人末端执行器的位置和姿态,计算出各个关节的角度和长度。这对于控制机器人的运动非常重要,因为它可以帮助我们确定机器人各个关节的运动范围和工作空间。

qq_59747472的博客 1135

Linux下编译报错,游离问题

1:1: error: stray ‘\377’ in program 1:1: error: stray ‘\377’ in program 上述报错,不是代码的问题,是文本内容格式的问题,windows下正常,但是linux下编译就报错。 解决方式: 1:在Windows上新建一个文本文件 2:将源码拷贝到文件文件 3:将文本文件另存格式为ASN1格式 4:将文本文件改名为工程文件就好了 ...

struborn_b的博客 451

YOLO26全网首发:CVPR2026 FAA| 解决YOLO Neck跨尺度方向冲突--- FAAFusion频域对齐融合模块 | 暴力涨点篇

本文改进:FAAFusion引入YOLO neck ,代替nn.Upsample和Concat

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 654

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

QT编译错误 :stray '\' in program

1.换行后自己写了注释——>去掉注释 IP_Port = tr("[%1:%2]:").arg(clients[i]->peerAddress().toString().split("::ffff:")[1])\ //注释错 .arg(clients[i]->peerPort()); 2.少打括号 ...

仲羊的博客 3767

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

编译错误:stray ‘\357’ in program的解决方法

编译错误:stray ‘\357’ in program的解决方法

jacke121的专栏 2266

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

ARM编译Qt程序报错pinyin.cpp:1: error: stray ‘\357‘ in program

Qt程序用gcc编译可以通过,用arm-linux-gcc编译文件的时候出现异常错误。

技术无界,行者无疆。 702

error: stray ‘\357’ in program——输入了中文的标点符号

中文标点符号

sinat_36384705的博客 2万+

C语言错误--[Error] stray '`' in program--解决方法。

[Error] stray ‘`’ in program stray 的中文意思是迷失,错误提示为stray很大可能是出现了不可识别的字符,检查是否使用了中文字符。 我错误的原因,根据《The C Programming Language》 练习2-1的答案,因为印刷原因。我将 ~0 写成了 导致无法识别符号。 ...

weixin_43641971的博客 3万+

error: stray ‘\’ in program

编译错误1 stray ‘\’ in program2 其实根源是出在转义字符上 1 stray ‘\’ in program 在C/C++中,出现这个错误,第一时间会认为是在程序中输入了中文字符,因此只需要将中文字符修改即可。不错,这是正确的。 2 其实根源是出在转义字符上 下面是一些典型的转义字符,那么,除了规定的转义字符外,其他转义字符均是非法的,换句话说以\开头且合法的,只有规定的转义字符 当然,下面的代码是非法的,错误原因就是标题。C/C++没有定义转义字符\d "\d" 然而,我们的本意并不

我爱加菲猫 2万+

Linux 编译时出现类似error: stray '\357' in program的解决方法

原因: 在程序中打入了全角字符 具体分析产生原因: 在编程中,由于打字的快速,按下ctrl键后紧接着按下了space键,由于按下两个键的间隙比较短,导致系统误检测到ctrl + space信号,将输入法从半角切换到全角。 解决方法: 只需将定位的错误行号对应的代码删掉重新输入即可。 转载于:https://www.cnblogs.com/beatrice7/p/3932085.htm...

weixin_30846599的博客 414

QT编译出现stray '\343' in program错误

QT编译出现stray '\343' in program错误   1.问题出现的原因:                     代码中出现全角的符号。   2.问题解决的方法:                                                                通过 cat -A  加文件名  查看那些地方出现了全角符号,如果为$表示正常,其

sbisyju的专栏 7172

Qt中出现 stray ‘\342‘ in program 错误

问题:粘过来的代码出现如上错误;但是,代码本身没有错误。 原因:代码中有中文格式的内容??? 解决方法:重新敲一遍即可。

modi000的博客 3327
上一篇: Qt5.6.0 移植到ARM(tq2440)步骤及问题记录
下一篇: QT+ffmpeg 简单视频播放代码及问题记录
Chasing_Chasing
博客等级 码龄10年 233粉丝 87原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址