PDA

View Full Version : Qt4/C++ - Adding a 'C' program - missing stdarg.h



jimbo
8th May 2015, 10:45
Hello,

I'm trying to add an existing 'C' file to my Qt4 project, and have a header missing - 'stdarg.h'.

I can find matching file files on my system.

sudo find -name stdarg.h
./usr/include/c++/4.6/tr1/stdarg.h
./usr/lib/gcc/arm-linux-gnueabihf/4.8/include/stdarg.h
./usr/lib/gcc/arm-linux-gnueabihf/4.6/include/stdarg.h

I can put the full path in the 'C' file, but would prefer not to change the 'C' file, if possible.
Would it be reasonable, just to copy the header to my source directory?
This would still need a change to the 'C' source. <stdarg.h> to "stdarg.h".
Would it be possible to add it to the .pro file, as a +=include?

Regards

ChrisW67
8th May 2015, 12:04
What platform are you building on? A Linux I assume.
What platform are you building for?

Does this program:


/* test.c */
#include <stdarg.h>

int main(int argc, char **argv) { return 0; }

compile with:


gcc -v -c test.c

or whatever your C compiler is actually called? The verbose output will tell you exactly where it will look for stdarg.h.

jimbo
8th May 2015, 12:55
Hello,

Thanks for your reply.

This is on a Raspberry Pi (arm).
Raspian - Wheezy.
I'm compiling from within Qt Creator.

pi@mypi ~ $ uname -a
Linux mypi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux

Qt Creator 3.2.2

gcc -v
gcc version 4.6.3 (Debian 4.6.3-14+rpi1)


pi@mypi ~/Desktop/test $ gcc -v -c test.c
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
COLLECT_GCC_OPTIONS='-v' '-c' '-march=armv6' '-mfloat-abi=hard' '-mfpu=vfp'
/usr/lib/gcc/arm-linux-gnueabihf/4.6/cc1 -quiet -v -imultilib . -imultiarch arm-linux-gnueabihf test.c -quiet -dumpbase test.c -march=armv6 -mfloat-abi=hard -mfpu=vfp -auxbase test -version -o /tmp/cc0e4Vik.s
GNU C (Debian 4.6.3-14+rpi1) version 4.6.3 (arm-linux-gnueabihf)
compiled by GNU C version 4.6.3, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=89 --param ggc-min-heapsize=110548
ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabihf"
ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/arm-linux-gnueabihf/4.6/include
/usr/local/include
/usr/lib/gcc/arm-linux-gnueabihf/4.6/include-fixed
/usr/include/arm-linux-gnueabihf
/usr/include
End of search list.
GNU C (Debian 4.6.3-14+rpi1) version 4.6.3 (arm-linux-gnueabihf)
compiled by GNU C version 4.6.3, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=89 --param ggc-min-heapsize=110548
Compiler executable checksum: cf78bfe2d99d4ca6e0637950db1b4acd
COLLECT_GCC_OPTIONS='-v' '-c' '-march=armv6' '-mfloat-abi=hard' '-mfpu=vfp'
as -march=armv6 -mfloat-abi=hard -mfpu=vfp -meabi=5 -o test.o /tmp/cc0e4Vik.s
COMPILER_PATH=/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/
LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../:/lib/arm-linux-gnueabihf/:/lib/:/usr/lib/arm-linux-gnueabihf/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-c' '-march=armv6' '-mfloat-abi=hard' '-mfpu=vfp'
pi@mypi ~/Desktop/test $

It produces a test.o file

Regards

jimbo
8th May 2015, 17:21
Hello,

A solution I've found that seems to work is :-

Add INCLUDEPATH += /usr/lib/gcc/arm-linux-gnueabihf/4.6/include/ to the pro file.

Regards