clion莫名其妙的报错,请各位大神帮忙看下是啥原因
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了clion莫名其妙的报错,请各位大神帮忙看下是啥原因相关的知识,希望对你有一定的参考价值。
种情况出现在很多时候,而且都是重新开个新的clion窗口再把代码复制进去就可以debug了"D:\clion\JetBrains\CLion 2016.1.1\bin\cmake\bin\cmake.exe" --build C:\Users\LULULU\.CLion2016.1\system\cmake\generated\cprimerplus7_1-a66632b4\a66632b4\Debug --target all -- -j 8
[ 50%] Building CXX object CMakeFiles/cprimerplus7_1.dir/main.cpp.obj
[100%] Linking CXX executable cprimerplus7_1.exe
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot open output file cprimerplus7_1.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
CMakeFiles\cprimerplus7_1.dir\build.make:95: recipe for target 'cprimerplus7_1.exe' failed
mingw32-make.exe[2]: *** [cprimerplus7_1.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/cprimerplus7_1.dir/all] Error 2
CMakeFiles\Makefile2:66: recipe f 参考技术A 先在Run菜单下点Stop(CTRL+F2)再编译运行
python程序执行报错,请大神帮忙看下
# -*- coding: cp936 -*-
#--conding: -utf-8--
#给出三角形的三条边长,判断该三角形的形状,并计算面积
_metaclass_=type
class sanJiaoXing:
mianji=0
p=0
def init(self):
a=int(raw_input("a="))
b=int(raw_input("b="))
c=int(raw_input("c="))
if a+b<c or a+c<b or b+c<a:
print "两边之和小于第三边,无法构成三角形"
elif a==b==c:
print "这个三角形是等边三角形"
elif a==b!=c or b==c!=a or a==c!=b:
print "这个三角形是等腰三角形"
elif a*a+b*b==c*c or a*a+c*c==b*b or b*b+c*c==a*a:
print"这个是直角三角形"
else:
print"这个是一般三角形"
def MianJi(self):
from math import sqrt
p=(a+b+c)/2
mianji=sqrt(p*(p-a)*(p-b)*(p-c))
print "三角形的面积为:%s" % mianji
test=sanJiaoXing()
test.init()
test.MianJi()
错误信息
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\python1\三角形判断.py", line 32, in <module>
test.MianJi()
File "C:\Users\Administrator\Desktop\python1\三角形判断.py", line 26, in MianJi
p=(a+b+c)/2
NameError: global name 'a' is not defined
>>>
支持xhkczxzz.
再来一个:
#!/usr/bin/env python# coding: utf-8
#
# filename: triangle.py
# date: Feb., 2014
# author: Tim Wang
class Triangle(object):
def __init__(self, a, b, c):
self.lines = sorted([a, b, c])
if self.lines[0] + self.lines[1] <= self.lines[2]:
raise TypeError
def category(self):
if self.lines[0] == self.lines[1] == self.lines[2]:
return u"等边三角形"
category = u""
if (self.lines[0] == self.lines[1] or
self.lines[1] == self.lines[2]):
category += u"等腰"
A = self.lines[0] ** 2 + self.lines[1] ** 2
B = self.lines[2] ** 2
if A == B:
category += u"直角"
elif A > B:
category += u"锐角"
else:
category += u"钝角"
return category + u"三角形"
def perimeter(self):
"""周长"""
return self.lines[0] + self.lines[1] + self.lines[2]
def area(self):
"""面积(海伦公式)"""
p = sum(self.lines)/2.
return (p
* (p - self.lines[0])
* (p - self.lines[1])
* (p - self.lines[2])
) ** .5
def R(self):
"""外接圆半径"""
return (self.lines[0]
* self.lines[1]
* self.lines[2] ) / (4 * self.area())
tr = Triangle(3, 4, 5)
print tr.perimeter()
print tr.area()
print tr.R()
print tr.category().encode("utf-8") 参考技术A 把a\b\c改为:
self.a
self.b
self.c追问
多谢,多谢,
在这边的时候是不是应该添加break啊,
if a+b<c or a+c<b or b+c<a:
print "两边之和小于第三边,无法构成三角形"
我输入三边为1,2,1时,仍执行了下面的求面积的方法了。
可是我加了break会有问题,求大神再次帮忙看下。多谢多谢
mianji=p=0
issanJiaoXing=False
def __init__(self): #######
self.a=int(raw_input("a="))
self.b=int(raw_input("b="))
self.c=int(raw_input("c="))
self.isSanjiaoxing(self.a,self.b,self.c)
def isSanjiaoxing(self,a,b,c): #######
if self.a+self.b<=self.c or self.a+self.c<=self.b or self.b+self.c<=self.a:
print "非三角形"
self.issanJiaoXing=False ###
return
elif self.a==self.b==self.c:
print "等边"
elif self.a==self.b!=self.c or self.b==self.c!=self.a or self.a==self.c!=self.b:
print "等腰"
elif self.a*self.a+self.b*self.b==self.c*self.c or self.a*self.a+self.c*self.c==self.b*self.b or self.b*self.b+self.c*self.c==self.a*self.a:
print"直角"
else:
print"一般"
self.issanJiaoXing=True ###
def MianJi(self):
……
p=(self.a+self.b+self.c)/2.0 ######
……
test=sanJiaoXing()
test.MianJi()本回答被提问者采纳
以上是关于clion莫名其妙的报错,请各位大神帮忙看下是啥原因的主要内容,如果未能解决你的问题,请参考以下文章
spring整合mybatis时运行测试代码报错Injection of autowired dependencies failed,请各位大神帮忙看看
完美解决ie11 f12控制台报错(KB3008923补丁) 在那里下载安装哦~~请各位大神帮帮忙
求助各位大神帮我看下 Unity3d 与 Android 交互的问题