AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[c](ubuntu)

Martin Hope
SpeedChaser
Asked: 2022-06-25 08:25:55 +0800 CST

你能帮我在 Ubuntu 18.04 上安装 clang-14 吗?我想我需要一个有效的回购,因为 apt-get install clang-14 不起作用:(

  • 1
$ cat /etc/issue
Ubuntu 18.04 LTS \n \l

$ sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Reading package lists... Done

$ sudo apt-get install clang-14
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package clang-14

$ clang++ -v
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
c
  • 2 个回答
  • 527 Views
Martin Hope
Fernando Magnabosco
Asked: 2022-05-15 13:45:32 +0800 CST

如何使用 C 在 linux 终端中打印 ■ 字符?

  • 5

该字符在 ASCII 扩展表中为 254,在 Unicode 中为 25A0。如果我运行putchar(254)终端无法识别字符,因为我认为它使用了未扩展的 ASCII。

c
  • 3 个回答
  • 1006 Views
Martin Hope
Zozzizzez
Asked: 2020-10-01 04:46:11 +0800 CST

gdb 和 gdb-peda 有什么区别?

  • 0

我试图在谷歌上搜索,但仍然找不到我理解的任何内容。

谁能告诉我它们之间的区别?哪个更适合调试 c++?

debugging c c++ gdb 20.04
  • 1 个回答
  • 1672 Views
Martin Hope
SriHarsha
Asked: 2020-09-28 21:33:06 +0800 CST

如何在 Ubuntu 18.04 中安装 gcc 4.8?

  • 4

我目前使用的是 Ubuntu 18.04,我需要 MATLAB 的 gcc 4.8。所以我尝试使用安装 gcc-4.8

$ sudo apt-get install gcc-4.8
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-117.118_amd64.deb  404  Not Found [IP: 2403:8940:3:1::f 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

所以我运行了命令

sudo apt-get update 

我没有显示任何错误,但运行 gcc version 命令给出了这个

$ gcc -v
Command 'gcc' not found, but can be installed with:
sudo apt install gcc

以前我曾经有 7.5,但现在没有了。

software-installation gcc c compiler
  • 2 个回答
  • 3935 Views
Martin Hope
tanya singh
Asked: 2020-08-21 21:40:02 +0800 CST

C 中的 sleep() 函数在 Ubuntu 20.04 (WSL) 上不起作用。有什么方法可以让 sleep() 工作吗?

  • 1

我正在使用适用于 Ubuntu 的 Windows 应用程序来练习 C/C++ 代码。

最终我发现这个sleep()电话在这里不起作用。我浏览了之前在其他帖子上提供的答案,但找不到任何相关的解决方案。

所以我只想知道是否有任何方法可以sleep()在同一个 Ubuntu 应用程序上进行类似的等待调用?

示例代码:

#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<signal.h>

void handler(int num)
{
        write(STDOUT_FILENO, "I am in handler...handling signal\n", 13);
}

int main(int argc, char **argv)
{
        signal(SIGINT, handler);
        signal(SIGTERM,handler);

        while(1)
        {
                printf("Just wasting your time! PID = %d\n", getpid());
                sleep(1);
        }

}
command-line c windows-subsystem-for-linux
  • 1 个回答
  • 1367 Views
Martin Hope
code_worker
Asked: 2020-07-13 20:37:39 +0800 CST

在系统监视器中查找时内存分配不同

  • 2

我编写 ac 程序来分配特定大小的内存并释放它们。

默认情况下,它通过 malloc 1MB 为 100 大小数组的每个条目创建总共 100MB 内存。

当我查找系统监视器并找到程序(添加系统暂停以查找)时,它仅在内存字段中显示292KiB 。真的吗?292KiB 和 100MB 有很大的不同...

像下面这样的代码,你可以编译和运行。

#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdint.h>
#include <getopt.h>

static const char *progname;
struct optargs {
 int size;
};

static struct option long_options[] = {
 {"size",                1, 0, 's'},
 {"help",                0, 0, 'h'},
 { NULL,                 0, 0,  0 }
};

void Usage() {
 printf("Allocate 150MB memory\n./program --size|-s 150\n");
 exit(0);
}

int run(struct optargs opts) {
 char *ptr[opts.size];
 int steps = 4;
 int sz_unit = 1048576; // 1MB

 for (int i=0;i<opts.size;i++) {
  ptr[i] = calloc(sz_unit, sizeof(char));
 }

system("read -p 'Press Enter to continue...' var");
 for (int i=0;i<opts.size;i++) {
  free(ptr[i]);
 }

 return 0;
}

int main(int argc, char **argv) {

 int opt_size = 0;
 int c;
 struct optargs opts;
 progname = argv[0];

 while ((c = getopt_long(argc, argv, "s:h", long_options, NULL)) != -1) {
  switch(c) {
   case 's':
    opt_size = 1;
    opts.size = atoi(optarg);
    break;

   default:
    Usage();
    break;
  }
 }

 if (!opt_size)
  opts.size = 100;
 printf("Will allocate %dMB memory\n", opts.size);
 run(opts);
 return 0;
}

编译并运行:

gcc FILE -o run
./run
ram c
  • 1 个回答
  • 71 Views
Martin Hope
Gennaro Arguzzi
Asked: 2020-06-18 00:55:45 +0800 CST

在 ubuntu 19.10 上安装 allegro 4.4

  • 1

我从这里下载了 allegro 4.4 的存储库,但我不知道如何在 ubuntu 上安装它。我寻找教程,但我没有找到它们。你能告诉我如何安装它吗?

也许有一种更舒适的安装方式,例如在终端中编写一个命令(在这种情况下,应该从终端下载软件)?

谢谢您的帮助。

software-installation libraries c 19.10
  • 1 个回答
  • 1610 Views
Martin Hope
J. Doe
Asked: 2020-05-15 00:07:22 +0800 CST

尝试安装 GCC [重复]

  • -1
这个问题在这里已经有了答案:
更新 Ubuntu 时如何避免“请插入 CD/DVD”错误? (2 个回答)
2年前关闭。

我想通过这个命令安装 gcc 编译器 apt install build-essential

按是后,它要求我插入一些媒体。

Media change: please insert the disc labeled
'Ubuntu 18.04.4 LTS _Bionic Beaver_ - Release amd64 (20200203.1)' in the drive '/media/cdrom/' and press [Enter]

并且这个提示一次又一次地重复

怎么了?

command-line gcc c 18.04
  • 1 个回答
  • 303 Views
Martin Hope
HARUN SASMAZ
Asked: 2020-03-03 02:55:58 +0800 CST

使用 cron 作业播放音频

  • 1

我正在尝试向我自己的 shell 添加一个新命令,例如:

alarm 7.15 music.wav

我想创建一个 cron 作业,以便它可以在给定时间每天安排警报。所以,我为每次报警调用创建一个文件,命名为musicFile.txt

这是我要运行的 bash 文件:(musicFile.txt)

#!/bin/bash 
15 7 * * * XDG_RUNTIME_DIR=/run/user/$(id -u) play -q /home/harun/Desktop/music.wav > alarmFile 
crontab alarmFile 
rm -f alarmFile 
rm -f musicFile.txt 

我用 execvp 执行这条评论:

bash musicFile.txt

然而,什么也没有发生。我应该如何使用 crontab 设置闹钟?

bash cron c
  • 1 个回答
  • 1276 Views
Martin Hope
Bill_Tsor
Asked: 2019-12-18 12:03:21 +0800 CST

对于 Lubuntu,我需要一个用于 C 编码的轻量级 IDE

  • 1

我对linux一无所知,我一生都在使用Windows。我最近将 Lubuntu 安装到了一台我没用过的非常旧的笔记本电脑上。我需要为 C 编码安装一个轻量级 IDE,以满足我的大学需求。我只在能够处理这些软件的主计算机中使用了 Dev C++ 和 Visual Studio。但是我需要在我的笔记本电脑上安装一个可以正常工作的 IDE,它只适合我在途中进行编码。关于我的笔记本电脑的一些信息:笔记本电脑:Acer extensa 5230 CPU:英特尔赛扬 2Ghz 单核 32 位 RAM:1GB ddr2 存储:160GB 提前感谢您的帮助。PS:任何有关在 linux 上启动的建议都会非常有帮助。

ide lubuntu c
  • 1 个回答
  • 3766 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve