Tag: makefile

将GTK3.0项目移植到GTK2.0

我正在构建一个简单的GUI应用程序,我已成功部署并运行在我的Raspberry PI开发板上。 但是,由于OpenCV依赖于GTK + v2.0的问题,我必须将我的应用程序反向移植到旧版本的GTK +。 我已经熟悉改变包含路径等等,以及我的makefile中的库链接命令。 但是,当我进行所有必要的更改时,在构建期间会发生致命错误。 Building dependencies file for main.o In file included from /opt/rpi/usr/include/gtk-2.0/gdk/gdkscreen.h:32:0, from /opt/rpi/usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:31, from /opt/rpi/usr/include/gtk-2.0/gdk/gdk.h:32, from /opt/rpi/usr/include/gtk-2.0/gtk/gtk.h:32, from inc/ui.h:8, from main.c:10: /opt/rpi/usr/include/gtk-2.0/gdk/gdktypes.h:55:23: fatal error: gdkconfig.h: No such file or directory 我已经确认我的GTK + v3.0安装缺少文件gdkconfig.h : find /opt/rpi/usr/include -iname “gdkconfig*” ./gtk-3.0/gdk/gdkconfig.h 但是我的GTK + v2.0安装没有这样的文件。 我已经通过apt-get安装了最新版本,但仍然没有运气。 这个问题有什么解决方案吗? 谢谢。

Linux makefile示例

嗨,我是linux的新手,我正在通过一个例子http://www.linuxforu.com/2010/12/writing-your-first-linux-driver/我正在使用Ubuntu 12.04并创建了c代码文件名为ofd.c(见下文),保存在我在〜/ Development / MyProgs / myHelloWorldLinuxModule / v2创建的目录中。 我还创建了一个Makefile(见下文),它位于同一目录中。 当我输入make时,我希望在同一目录中看到生成的.ko文件,但我得到的是一条消息“默认情况下无法完成” 我真的不懂makefile 我应该在某个地方定义KERNELRELEASE, 默认情况下实际执行的是什么行,这是否意味着在内核目录和工作目录上执行make,或者我应该将我的代码特别放在某处。 没有usr/src/linux but a /usr/src/linux-headers-3.8.0-29 ,所以我改变了这个,这是正确的。 (虽然似乎没有任何区别)。 任何帮助将不胜感激。 码: /* ofd.c – Our First Driver code */ #include #include #include static int __init ofd_init(void) /* Constructor */ { printk(KERN_INFO “Namaskar: ofd registered”); return 0; } static void __exit ofd_exit(void) /* Destructor */ […]

类似Arduino的Makefile与依赖…?

我目前正在尝试使用SDCC OS编译器为STM8微控制器开发C库和项目模板。 我的目标是一个(几乎)与NOdu兼容的设置,类似于Arduino – 但是使用make + shellscripts而不是IDE(我的野心有限……) 目前我正在努力使用make来自动检测依赖项。 在Arduino中,用户只包含相关的头文件,例如“#include LCD-lib”,构建机制自动检测依赖关系并链接各自的库。 无需手动将其添加到IDE或Makefile。 我喜欢它的简单性,但到目前为止,我在创建相应的Makefile时失败了。 基本上这是Makefile应该实现的: 扫描项目根目录中的* .c文件以获取包含的标头。 请注意,这些文件位于不同的lib文件夹中 将所有包含的标头和(如果存在)相应的C文件添加到构建过程 为了最小化编译时间和大小,必须在构建期间跳过lib文件夹中未使用的C文件 我相信make可以做到以上所有 – 但不是我的制作经验…… 🙁 这是我想到的文件夹结构: ├── Library │ ├── Base │ │ ├── general STM8 sources and headers │ ├── STM8S_Discovery │ │ └── board specific sources and headers │ └── User │ └── optional user library […]

mkdir的隐式声明

对于我的问题,让我假设我有两个函数,它们都是在库文件夹中的.h文件中的原型,以及.c辅助文件中的实现(如下所示),我将在我的程序中使用它们。 calsis.c #include #include #include #include #include “include/calsis.h” /* Extern header */ char folder_name[30] = “Information”; void no_args() /* Function 1 */ { printf(“Hello, world!\n”); if ( mkdir(folder_name, S_IRWXU) == -1 ) perror(“Can’t create a new folder”); } void with_args(char *foo) /* Function 2 */ { printf(“Hello, world!\n”); printf(“Name: %s\n”, foo); if ( mkdir(folder_name, S_IRWXU) […]

makefile中的gdb和valgrind

我有一个非常基本的问题。 我确实在这里环顾四周http://www.cs.cmu.edu/~gilpin/tutorial/但仍然怀疑.. 考虑以下makefile(在之前的问题中也给出了它) all: clients.so simulator backup LD_PRELOAD=/home/Juggler/client/clients.so ./simulator backup: backup.c libclient.a gcc backup.c -o backup -L /home/Juggler/client -L. -lclient -ldl simulator: simulator.c libclient.a gcc -g simulator.c -o simulator -L /home/Juggler/client -L. -lclient -ldl -pthread libclient.a: libclient.o client.o ar rcs libclient.a libclient.o client.o libclient.o:libclient.c gcc -c libclient.c -o libclient.o -pthread clients.so: client.o client_invoke.o ld -shared […]

GCC makefile不接受-std = c99 -lm

我用gcc编译器的makefile有问题。 如果我直接使用gcc: gcc -std=c99 -lm tm.c tm_coins.c tm_options.c tm_stock.c tm_utility.c -o tm -Wall -pedantic 一切正常。 我需要-std-c99和-lm。 但是,我被告知使用makefile。 这是我的make文件: CFLAGS=-ansi -Wall -pedantic LFLAGS=-std=c99 -lm CC=gcc all:tm tm:tm.o tm_coins.o tm_options.o tm_stock.o tm_utility.o $(CC) $(LFLAGS) tm.o tm_coins.o tm_options.o tm_stock.o tm_utility.o -o tm $(CFLAGS) tm.o: tm.h tm.c $(CC) $(LFLAGS) $(CFLAGS) -c tm.c tm_coins.o:tm_coins.h tm_coins.c $(CC) $(LFLAGS) $(CFLAGS) -c tm_coins.c […]

如何在Android.mk的LOCAL_CFLAGS中动态获取当前编译器目标文件名?

我目前正在尝试使用Android的NDK构建本机模块。 我的项目包含几个源文件(例如: FILENAME .c),对于每个源文件,我需要在其CFLAGS( -DOPERATION_FILENAME )中声明一个定义。 为此,我需要动态获取Android NDK交叉编译器的当前目标文件的名称,并将其用于定义值。 我找不到任何有关如何执行此操作的信息,并且Makefile方式( CFLAGS + = -DOPERATION_ echo $* | sed ‘s/_$$//’ )不适用于此处。 我目前的Android.mk看起来像这样: LOCAL_PATH:=$(call my-dir) include $(CLEAR_VARS) LOCAL_ARM_MODE := arm LOCAL_MODULE := libmpn LOCAL_SRC_FILES := \ LOCAL_CFLAGS := \ -std=gnu99 \ -DHAVE_CONFIG_H \ -D__GMP_WITHIN_GMP \ -O2 \ -pedantic \ -fomit-frame-pointer \ -mfloat-abi=softfp \ -DOPERATION_`echo $* | sed ‘s/_$$//’` […]

如果从shell运行,则完全相同的命令行会在Make中生成错误但仍然成功

我有一个问题,我无法绕过头脑。 我有一个最小的示例makefile,它应该将一个非常简单的.c文件编译成可执行程序。 当我运行make时 ,编译器开始编译然后生成错误消息 “T:\ printOffsets.c:10:21:错误:bootIfc.h:没有这样的文件或目录” 然后我复制完全相同的命令行make is用于构建目标并直接在同一个Windows命令shell实例中运行它,突然编译成功而没有错误! 命令行是(路径名简化): T:\ perl \ c \ bin \ gcc.exe T:\ printOffsets.c -IT:\ include \ -o D:\ printOffsets.exe 我怎么知道? 好吧, make在执行它之前打印命令行,所以我只需从shell复制并粘贴。 我不明白! 这怎么可能?? 如果在Makefile中启动,那么完全相同的命令如何在shell上工作并失败? 顺便说一下,我在Windows 7上使用GNU Make 3.82。

C:主要没找到,但它就在那里 编译错误

当我编译下面给出的两个.c文件时,我得到一个非常奇怪的错误。 终端编译代码 gcc -I. -o main.c matrix.c -lblas -lgfortran 错误: /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11 […]

存档问题不是C中链接的体系结构(x86_64)

当我在这个程序上运行make我正在尝试构建时,我收到这些警告: ld: warning: ignoring file ../lib/libiptools.a, file was built for archive which is not the architecture being linked (x86_64) ld: warning: ignoring file ../lib/libmpeg.a, file was built for archive which is not the architecture being linked (x86_64) 然后它显然无法用这个编译: ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make: *** [iptool] Error […]