About Netbeans

C、C++和Java语言
回复
bobye
帖子: 14
注册时间: 2007-10-20 21:20
送出感谢: 0
接收感谢: 0

About Netbeans

#1

帖子 bobye » 2007-12-02 12:49

example.c:
#include <math.h>
...sin(x)...

compiling need to type:gcc -lm example.c
if only to type: gcc example.c
imformation received:undefined reference to 'sin'

Netbeans platform:

while I press the button F9,I will receive the imformation below:

在 /home/bobye/My project/6-6 中运行 "rm -rf build/Debug/GNU-Linux-x86/6-6.o"


清理 成功。 退出值 0。

在 /home/bobye/My project/6-6 中运行 "/usr/bin/make -f nbproject/Makefile-Debug.mk build/Debug/GNU-Linux-x86/6-6.o"

mkdir -p build/Debug/GNU-Linux-x86
gcc -c -g3 -gdwarf-2 -o build/Debug/GNU-Linux-x86/6-6.o 6-6.c

生成 成功。 退出值 0。

press the button F6:

在 /home/bobye/My project/6-6 中运行 "/usr/bin/make -f Makefile CONF=Debug"

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/bobye/My project/6-6'
mkdir -p dist/Debug/GNU-Linux-x86
gcc -o dist/Debug/GNU-Linux-x86/6-6 build/Debug/GNU-Linux-x86/6-6.o
build/Debug/GNU-Linux-x86/6-6.o: In function `f':
/home/bobye/My project/6-6/6-6.c:17: undefined reference to `sin'
/home/bobye/My project/6-6/6-6.c:19: undefined reference to `sqrt'
/home/bobye/My project/6-6/6-6.c:20: undefined reference to `pow'
collect2: ld 返回 1
make[1]: *** [dist/Debug/GNU-Linux-x86/6-6] 错误 1
make[1]: Leaving directory `/home/bobye/My project/6-6'
make: *** [.build-impl] 错误 2

生成 失败。 退出值 2。

HOW TO LET IT KNOW I WANT TO USE gcc -ml ?
回复

回到 “C/C++/Java”