标签: cc

在Makefile中CC?=是什么意思?

我有一个包含声明的C程序的Makefile

CC?=gcc
Run Code Online (Sandbox Code Playgroud)

把它改成

CC?=g++
Run Code Online (Sandbox Code Playgroud)

不会用g ++编译它.把它改成

CC=g++
Run Code Online (Sandbox Code Playgroud)

是否使用g ++.

所以我想知道?=运算符是做什么的?我的猜测是它查看一个环境变量来决定使用哪个编译器,如果没有设置,那么使用gcc?谁可以解决这个问题?

gcc makefile g++ cc

26
推荐指数
3
解决办法
3万
查看次数

Valgrind macOs和错误Syscall param msg-> desc.port.name指向未初始化的字节

我尝试在非常简单的项目中运行valgrind 3.13和3.14(在macOs 10.12.6上),但我得到了一个奇怪的错误,我以前从未在linux中获得过.

  1. 非常简单的C程序main.c:

    int main() {
        return (0);
    }
    
    Run Code Online (Sandbox Code Playgroud)
  2. 编译cc:

    $> cc main.c
    
    Run Code Online (Sandbox Code Playgroud)
  3. 运行我的简单程序valgrind:

    $> valgrind ./a.out
    
    Run Code Online (Sandbox Code Playgroud)
  4. valgrind的输出:

    ==12768== Memcheck, a memory error detector
    ==12768== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==12768== Using Valgrind-3.14.0.SVN and LibVEX; rerun with -h for copyright info
    ==12768== Command: ./a.out
    ==12768==
    ==12768== Syscall param msg->desc.port.name points to uninitialised byte(s)
    ==12768==    at 0x10049434A: mach_msg_trap (in /usr/lib/system/libsystem_kernel.dylib)
    ==12768==    by 0x100493796: mach_msg (in /usr/lib/system/libsystem_kernel.dylib)
    ==12768==    by …
    Run Code Online (Sandbox Code Playgroud)

c macos valgrind cc

12
推荐指数
1
解决办法
1104
查看次数

为什么我会收到此错误:"数据定义没有类型或存储类"?

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

struct NODE {
    char* name;
    int val;
    struct NODE* next;
};
typedef struct NODE Node;

Node *head, *tail;
head = (Node*) malloc( sizeof( Node ) ); //line 21
Run Code Online (Sandbox Code Playgroud)

我编译如下:

cc -g -c -o file.tab.o file.tab.c
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

file.y:21:1 warning: data definition has no type or storage class [enabled by default]
Run Code Online (Sandbox Code Playgroud)

c struct pointers bison cc

9
推荐指数
1
解决办法
3万
查看次数

rustdiesel 与 `cc` 链接失败

好吧,这里有点无处可去。在我发布了我的 Mac M1 与 Rust Diesel 的链接器问题并没有得到任何结果之前。因此,我启动了一个 Ec2 实例,并尝试在此处运行此包,并得到以下结果:

error: linking with `cc` failed: exit status: 1
...
 = note: /usr/bin/ld: cannot find -lpq
Run Code Online (Sandbox Code Playgroud)

我已经安装了以下内容:

sudo yum update -y
sudo yum install git -y
sudo yum groupinstall "Development Tools" -y
sudo yum install cmake -y
sudo yum install postgresql-libs -y
Run Code Online (Sandbox Code Playgroud)

说真的,人们是如何设法让这个箱子运行的?

linker cc rust rust-diesel

8
推荐指数
1
解决办法
3395
查看次数

快速覆盖-Werror标志的方法?

如果cc配置设置为use -Werror,有没有办法-Werror在使用make时覆盖终端的标志?

c gcc makefile cc

7
推荐指数
1
解决办法
2万
查看次数

在OS X上的virtualenv中安装scrapy加密时出错

我与安装scrapy pipvirtualenvOS X 10.11.当它正在安装加密时,它说:

building '_openssl' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c build/temp.macosx-10.11-intel-2.7/_openssl.c -o build/temp.macosx-10.11-intel-2.7/build/temp.macosx-10.11-intel-2.7/_openssl.o
build/temp.macosx-10.11-intel-2.7/_openssl.c:423:10: fatal error: 'openssl/e_os2.h' file not found
#include <openssl/e_os2.h>
     ^
1 error generated.
error: command 'cc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
Command "/Users/Kris/Workspace/env/scrapy/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/wx/jm7lxhps3n7484zl4gv9s3180000gn/T/pip-build-2rJYgI/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, …
Run Code Online (Sandbox Code Playgroud)

python macos cryptography cc scrapy

7
推荐指数
1
解决办法
2977
查看次数

如何让 CMake 在系统 PATH 上使用默认编译器?

同样的问题和答案。问题是答案似乎是错误的(实际上并不是所问问题的答案)。我可以重新提问吗?问题:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ whereis gcc
cc: /usr/bin/gcc /usr/lib/gcc /usr/local/bin/gcc /usr/libexec/gcc
$ which gcc
/usr/local/bin/gcc
$ /usr/bin/gcc -v
gcc version 4.1.2
$ /usr/local/bin/gcc -v
gcc version 4.8.4
$ gcc -v
gcc version 4.8.4
$ cmake .
-- The C compiler identification is GNU 4.1.2
...
...
Run Code Online (Sandbox Code Playgroud)

本地 GCC 版本如果是 4.8.4 并且系统的默认版本是“4.1.2”。所有其他工具链都遵守 PATH 环境变量并使用本地(较新的)GCC 版本。除了 CMAKE。设置 CC 不是一个好主意,因为可能还有其他二进制工具也可以使用。在脚本开头设置 CMAKE_PROGRAM_PATH 和 CMAKE_PREFIX_PATH 无助于检测编译器。
有没有办法强制 CMAKE 尊重 PATH 变量?

linux path cmake cc

5
推荐指数
2
解决办法
1万
查看次数

错误(Mac OS):sudo pip install MySQl-python

我的命令有问题

sudo pip install MySQl-python
Run Code Online (Sandbox Code Playgroud)

所有日志:

  Downloading/unpacking MySQl-python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py (path:/private/tmp/pip_build_root/MySQl-python/setup.py) egg_info for package MySQl-python

Installing collected packages: MySQl-python
  Running setup.py install for MySQl-python
    building '_mysql' extension
    cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Wno-null-conversion -Os -g -fno-strict-aliasing -arch x86_64
    clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
    clang: note: this …
Run Code Online (Sandbox Code Playgroud)

mysql django macos xcode cc

4
推荐指数
1
解决办法
5057
查看次数

Generic Makefile无法在FreeBSD上运行

请注意,这与名为generic makefile的其他问题不重复.

我已经遵循了有关通用makefile的其他问题的所有说明,这是我从中得出的代码:

CFLAGS = -c
CC = cc
SOURCES = $(wildcard *.cc)
OBJECTS = $(patsubst %.cc,%.o,%(SOURCES))
EXEC = run

all: build clean

build: $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC)

%.o: %.cc
    $(CC) $(CFLAGS) $<

clean:
    rm *.o
Run Code Online (Sandbox Code Playgroud)

但是,当我make使用test.cc我的目录中调用的文件执行时,它会给我一个followig错误:

cc    -o run
cc: error: no input files
*** Error code 1

Stop.
make: stopped in /somewhere
Run Code Online (Sandbox Code Playgroud)

请注意我在FreeBSD上,makecc命令是操作系统附带的命令.

freebsd makefile cc

4
推荐指数
1
解决办法
1791
查看次数

makefile 中的 ${CC} 是什么意思?

我有使用${CC}变量进行编译器选择的 makefile:

${CC} $(CFLAGS) aaa.cpp -o aaa.o
Run Code Online (Sandbox Code Playgroud)

在 make ${CC} 期间带来 cc 编译器。${CC}但整体上没有定义makefile。这个变量怎么得呢cc

makefile cc

4
推荐指数
1
解决办法
9556
查看次数

标签 统计

cc ×10

makefile ×4

c ×3

macos ×3

gcc ×2

bison ×1

cmake ×1

cryptography ×1

django ×1

freebsd ×1

g++ ×1

linker ×1

linux ×1

mysql ×1

path ×1

pointers ×1

python ×1

rust ×1

rust-diesel ×1

scrapy ×1

struct ×1

valgrind ×1

xcode ×1