250533160 发表于 2017-1-17 04:46:42

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

还想问一下怎么看 error在哪

361628653 发表于 2017-1-17 07:58:41

是否支持long long这种类型,pow函数是不是浮点型的?我目前只看到这两个不妥的地方。

zealstar 发表于 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啥意思我也不清楚

人造人 发表于 2017-1-17 16:22:12

我怀疑是Makefile的问题,贴一下Makefile
gcc编译时需要加 -lm
似乎是你的编译器没有加
换一个编译器吧^_^

250533160 发表于 2017-1-18 02:34:52

361628653 发表于 2017-1-17 07:58
是否支持long long这种类型,pow函数是不是浮点型的?我目前只看到这两个不妥的地方。

谢谢

250533160 发表于 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:...

谢谢 {:5_110:}

250533160 发表于 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: Entering directory `/home/chenz15/Chm6'
"/usr/bin/make"-f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/chm6
make: 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: *** Error 1
make: Leaving directory `/home/chenz15/Chm6'
make: *** [.build-conf] Error 2
make: Leaving directory `/home/chenz15/Chm6'
make: *** [.build-impl] Error 2

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


因为我平时习惯去用软件已有的功能直接run,所以想问一下哪里有教 如何在terminal 手动输入run相关的资料

人造人 发表于 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文件的内容

250533160 发表于 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

人造人 发表于 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 ...

你用的软件是?

250533160 发表于 2017-1-18 04:07:17

人造人 发表于 2017-1-18 03:44
你用的软件是?

Netbeans

人造人 发表于 2017-1-18 06:40:21

250533160 发表于 2017-1-18 04:07
Netbeans

我认为是Cygwin的问题
建议去Cygwin官网下载最新的
我这边可以用了,在这之前我安装了最新的Cygwin

dxl1120 发表于 2017-1-18 08:55:10

没用过这个软件


这,只是开始→ 发表于 2017-1-18 09:24:44

我用 Code::Blocks 可以正常执行 打印出结果

250533160 发表于 2017-1-19 01:13:22

人造人 发表于 2017-1-18 06:40
我认为是Cygwin的问题
建议去Cygwin官网下载最新的
我这边可以用了,在这之前我安装了最新的Cygwin

wow,非常感谢{:5_106:}

250533160 发表于 2017-1-19 01:13:57

这,只是开始→ 发表于 2017-1-18 09:24
我用 Code::Blocks 可以正常执行 打印出结果

谢谢

1314xxxxxx 发表于 2017-5-21 11:17:06

第二十二行错误,英语我看不懂,可以找Google
页: [1]
查看完整版本: 新人贴, 不明白为啥一直无法run