鱼C论坛

 找回密码
 立即注册
查看: 3634|回复: 16

新人贴, 不明白为啥一直无法run

[复制链接]
发表于 2017-1-17 04:46:42 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
还想问一下怎么看 error在哪
2.PNG
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2017-1-17 07:58:41 | 显示全部楼层
是否支持long long这种类型,pow函数是不是浮点型的?我目前只看到这两个不妥的地方。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-17 09:59:41 | 显示全部楼层
/home/chenz15/chm6/main.c : 22: undefined reference to "pow"
第22行,未定义的引用 "pow"
collect2: error: ld returned 1 exit status
这行经常出现于编译器停止工作的情况,ld啥意思我也不清楚

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-17 16:22:12 | 显示全部楼层
我怀疑是Makefile的问题,贴一下Makefile
gcc编译时需要加 -lm
似乎是你的编译器没有加
换一个编译器吧^_^
无标题.png
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-1-18 02:34:52 | 显示全部楼层
361628653 发表于 2017-1-17 07:58
是否支持long long这种类型,pow函数是不是浮点型的?我目前只看到这两个不妥的地方。

谢谢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-1-18 02:37:15 | 显示全部楼层
zealstar 发表于 2017-1-17 09:59
/home/chenz15/chm6/main.c : 22: undefined reference to "pow"
第22行,未定义的引用 "pow"
collect2:  ...

谢谢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-1-18 02:40:25 | 显示全部楼层
人造人 发表于 2017-1-17 16:22
我怀疑是Makefile的问题,贴一下Makefile
gcc编译时需要加 -lm
似乎是你的编译器没有加

cd '/home/chenz15/Chm6'
/usr/bin/make -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/chenz15/Chm6'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/chm6
make[2]: Entering directory `/home/chenz15/Chm6'
mkdir -p dist/Debug/GNU-Linux
gcc     -o dist/Debug/GNU-Linux/chm6 build/Debug/GNU-Linux/main.o
build/Debug/GNU-Linux/main.o: In function `main':
/home/chenz15/Chm6/main.c:22: undefined reference to `pow'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux/chm6] Error 1
make[2]: Leaving directory `/home/chenz15/Chm6'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/chenz15/Chm6'
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 208ms)


因为我平时习惯去用软件已有的功能直接run,所以想问一下哪里有教 如何在terminal 手动输入run相关的资料
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-18 02:49:07 | 显示全部楼层
250533160 发表于 2017-1-18 02:40
cd '/home/chenz15/Chm6'
/usr/bin/make -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefi ...

不是这个,是Makefile文件的内容
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-1-18 02:57:53 | 显示全部楼层
人造人 发表于 2017-1-18 02:49
不是这个,是Makefile文件的内容

#
#  There exist several targets which are by default empty and which can be
#  used for execution of your targets. These targets are usually executed
#  before and after some main targets. They are:
#
#     .build-pre:              called before 'build' target
#     .build-post:             called after 'build' target
#     .clean-pre:              called before 'clean' target
#     .clean-post:             called after 'clean' target
#     .clobber-pre:            called before 'clobber' target
#     .clobber-post:           called after 'clobber' target
#     .all-pre:                called before 'all' target
#     .all-post:               called after 'all' target
#     .help-pre:               called before 'help' target
#     .help-post:              called after 'help' target
#
#  Targets beginning with '.' are not intended to be called on their own.
#
#  Main targets can be executed directly, and they are:
#  
#     build                    build a specific configuration
#     clean                    remove built files from a configuration
#     clobber                  remove all built files
#     all                      build all configurations
#     help                     print help mesage
#  
#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
#  .help-impl are implemented in nbproject/makefile-impl.mk.
#
#  Available make variables:
#
#     CND_BASEDIR                base directory for relative paths
#     CND_DISTDIR                default top distribution directory (build artifacts)
#     CND_BUILDDIR               default top build directory (object files, ...)
#     CONF                       name of current configuration
#     CND_PLATFORM_${CONF}       platform name (current configuration)
#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
#
# NOCDDL


# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...

.clean-post: .clean-impl
# Add your post 'clean' code here...


# clobber
clobber: .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post: .clobber-impl
# Add your post 'clobber' code here...


# all
all: .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post: .all-impl
# Add your post 'all' code here...


# build tests
build-tests: .build-tests-post

.build-tests-pre:
# Add your pre 'build-tests' code here...

.build-tests-post: .build-tests-impl
# Add your post 'build-tests' code here...


# run tests
test: .test-post

.test-pre: build-tests
# Add your pre 'test' code here...

.test-post: .test-impl
# Add your post 'test' code here...


# help
help: .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post: .help-impl
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk

# include project make variables
include nbproject/Makefile-variables.mk
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-18 03:44:21 | 显示全部楼层
250533160 发表于 2017-1-18 02:57
#
#  There exist several targets which are by default empty and which can be
#  used for execut ...

你用的软件是?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-1-18 04:07:17 | 显示全部楼层

Netbeans
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-18 06:40:21 | 显示全部楼层

我认为是Cygwin的问题
建议去Cygwin官网下载最新的
我这边可以用了,在这之前我安装了最新的Cygwin
无标题.png
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

发表于 2017-1-18 08:55:10 | 显示全部楼层
没用过这个软件


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-18 09:24:44 | 显示全部楼层
我用 Code::Blocks 可以正常执行 打印出结果
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-1-19 01:13:22 | 显示全部楼层
人造人 发表于 2017-1-18 06:40
我认为是Cygwin的问题
建议去Cygwin官网下载最新的
我这边可以用了,在这之前我安装了最新的Cygwin

wow,非常感谢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-1-19 01:13:57 | 显示全部楼层
这,只是开始→ 发表于 2017-1-18 09:24
我用 Code::Blocks 可以正常执行 打印出结果

谢谢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-5-21 11:17:06 | 显示全部楼层
第二十二行错误,英语我看不懂,可以找Google
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-6-29 14:34

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表