当我构建以下代码时,它构建良好.如果我更改代码注释掉"while",使用相同的命令行,它不会构建(见下文)
#include <stdio.h>
#include <mqueue.h>
int main(int argc, char *argv[]) {
while (1) { }
mq_open("/YouSUCK", O_RDWR | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG, NULL);
return 0;
}
dada@thud:~/RaspberryPI$ gcc -g -Wall -lrt -o mqtest mqtest.c
dada@thud:~/RaspberryPI$
#include <stdio.h>
#include <mqueue.h>
int main(int argc, char *argv[]) {
// while (1) { }
mq_open("/YouSUCK", O_RDWR | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG, NULL);
return 0;
}
dada@thud:~/RaspberryPI$ gcc -g -Wall -lrt -o mqtest mqtest.c
/tmp/cccw376u.o: In function `main':
/home/dada/RaspberryPI/mqtest.c:7: undefined reference …Run Code Online (Sandbox Code Playgroud)