Search Results

Search found 2303 results on 93 pages for 'llvm gcc'.

Page 5/93 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Tips on using GCC as a new programmer

    - by ultrajohn
    I am really new to GCC and I don't how to use it. I already have a copy of a pre-compiled gcc binaries i've downloaded from one of the mirror sites in the gcc website.. Now, I don't where to go from here... Please give me some tips on the different path to proceed..

    Read the article

  • Are nested functions a bad thing in gcc ?

    - by LB
    Hi, I know that nested functions are not part of the standard C, but since they're present in gcc (and the fact that gcc is the only compiler i care about), i tend to use them quite often. Is this a bad thing ? If so, could you show me some nasty examples ? What's the status of nested functions in gcc ? Are they going to be removed ? thanks

    Read the article

  • Two method for linking a object using GCC ?

    - by bluewater
    I've known that I should use -l option for liking objects using GCC. that is gcc -o test test.c -L./ -lmy But I found that "gcc -o test2 test.c libmy.so" is working, too. When I use readelf for those two executable I can't find any difference. Then why people use -l option for linking objects? Does it have any advantage?

    Read the article

  • GCC fatal error: stdio.h: No such file or directory

    - by user2615799
    I'm trying to compile a program in C on OS X 10.9 with GCC 4.9 (experimental). For some reason, I'm getting the following error at compile time: gcc: fatal error: stdio.h: No such file or directory I then tried a simple Hello World program: #include <stdio.h> int main(int *argc, const char *argv[]) { printf("Hello, world!"); return 0; } Again, upon running gcc -o ~/hello ~/hello.c, I got the same error. I'm using an experimental version of gcc, but it seems implausible that there would be a release which generated errors upon importing stdio. What could be causing this issue, and how can it be fixed?

    Read the article

  • Why is gcc failing with "unrecognized command line option "-L/lusr/opt/mpfr-2.4.2/lib" "?

    - by Mike
    My sysadmin recently installed a new version of GCC, in /lusr/opt/gcc-4.4.3. I tested it as follows: mike@canon:~$ cat test.c int main(){ return 0; } mike@canon:~$ gcc test.c /lusr/opt/gcc-4.4.3/libexec/gcc/i686-pc-linux-gnu/4.4.3/cc1: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory After informing my sysadmin about this, he said to add /lusr/opt/mpfr-2.4.2/lib:/lusr/opt/gmp-4.3.2/lib to my LD_LIBRARY_PATH. After doing this, I get the following error: mike@canon:~$ gcc test.c cc1: error: unrecognized command line option "-L/lusr/opt/mpfr-2.4.2/lib" First, my sysadmin wasn't entirely sure this was the best workaround(though he did say it worked for him...), so is there a better solution? Second, why am I getting a linker error from cc, and how can I fix it? Some information which may be helpful: mike@canon:~$ env | grep mpfr OLDPWD=/lusr/opt/mpfr-2.4.2/lib LD_LIBRARY_PATH=/lusr/opt/mpfr-2.4.2/lib:/lusr/opt/gmp-4.3.2/lib: mike@canon:~$ echo $LDFLAGS (the above is a blank line)

    Read the article

  • How to install old versions of gcc on Fedora without a VM?

    - by mikeh
    Hi, I need gcc 4.3 running alongside the shipped 4.4 on an FC13 machine. I can't do the VM solution discussed at http://serverfault.com/questions/88445/how-to-install-old-versions-of-gcc-on-fedora-12 since I need hardware access (CUDA computations on the graphics card). There's no compat-gcc-43 package (only compat-gcc-34). So I've built gcc by hand and am now trying to decide how to "install" it. Could anyone confirm that this was my only option, and/or suggest a best practice for how to manage the side-by-side gcc versions?

    Read the article

  • warning: incompatible implicit declaration of built-in function ‘xyz’

    - by Alex Reynolds
    I'm getting a number of these warnings when compiling a few binaries: warning: incompatible implicit declaration of built-in function ‘strcpy’ warning: incompatible implicit declaration of built-in function ‘strlen’ warning: incompatible implicit declaration of built-in function ‘exit’ To try to resolve this, I have added #include <stdlib.h> at the top of the C files associated with this warning, in addition to compiling with the following flags: CFLAGS = -fno-builtin-exit -fno-builtin-strcat -fno-builtin-strncat -fno-builtin-strcpy -fno-builtin-strlen -fno-builtin-calloc I am using GCC 4.1.2: $ gcc --version gcc (GCC) 4.1.2 20080704 What should I do to resolve these warnings? Thanks for your advice.

    Read the article

  • llvmc problem on ubuntu

    - by simk
    I have the exact problem as described in the link below http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537285 when i try to do llvmc hello.c -o hello it gives me this error: llvmc: Can't find program 'llvm-gcc' can anybody suggest me how to get rid of this issue? I have llvm-gcc installed, i am using ubuntu 9.10.

    Read the article

  • C++: warning: '...' declared with greater visibility than the type of its field '...::<anonymous>'

    - by Albert
    I'm getting these two warnings (with GCC 4.2 on MacOSX): /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154:0 /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154: warning: 'startMainLockDetector()::MainLockDetector' declared with greater visibility than the type of its field 'startMainLockDetector()::MainLockDetector::<anonymous' /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154:0 /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154: warning: 'startMainLockDetector()::MainLockDetector' declared with greater visibility than its base 'Action' In this code: struct Action { virtual ~Action() {} virtual int handle() = 0; }; static void startMainLockDetector() { /* ... */ struct MainLockDetector : Action { bool wait(Uint32 time) { /* ... */ } int handle() { /* ... */ } }; /* ... */ } I'm not exactly sure what these warnings mean (what visibility?) and how to fix them. (I really want the class MainLockDetector to be local for that function only.) I have already compiled the same code with a lot of other compilers (clang, GCC 3.*, GCC 4.0, GCC 4.4, etc) and never got any warning for this code.

    Read the article

  • GCC/X86, Problems with relative jumps

    - by Ian Kelly
    I'm trying to do a relative jump in x86 assembly, however I can not get it to work. It seems that for some reason my jump keeps getting rewritten as an absolute jump or something. A simple example program for what I'm trying to do is this: .global main main: jmp 0x4 ret Since the jmp instruction is 4 bytes long and a relative jump is offset from the address of the jump + 1, this should be a fancy no-op. However, compiling and running this code will cause a segmentation fault. The real puzzler for me is that compiling it to the object level and then disassembling the object file shows that it looks like the assembler is correctly doing a relative jump, but after the file gets compiled the linker is changing it into another type of jump. For example if the above code was in a file called asmtest.s: $gcc -c asmtest.s $objdump -D asmtest.o ... Some info from objdump 00000000 <main>: 0: e9 00 00 00 00 jmp 5 <main+0x5> 5: c3 ret This looks like the assembler correctly made a relative jump, although it's suspicious that the jmp instruction is filled with 0s. I then used gcc to link it then disassembled it and got this: $gcc -o asmtest asmtest.o $objdump -d asmtest ...Extra info and other disassembled functions 08048394 <main>: 8048394: e9 6b 7c fb f7 jmp 4 <_init-0x8048274> 8048399: c3 ret This to me looks like the linker rewrote the jmp statement, or substituted the 5 in for another address. So my question comes down to, what am I doing wrong? Am I specifying the offset incorrectly? Am I misunderstanding how relative jumps work? Is gcc trying to make sure I don't do dangerous things in my code?

    Read the article

  • gcc, strict-aliasing, and horror stories

    - by Joseph Quinsey
    In http://stackoverflow.com/questions/2906365/gcc-strict-aliasing-and-casting-through-a-union I asked whether anyone had encountered problems with union punning through pointers. So far, the answer seems to be No. This question is broader: do you have any horror stories about gcc and strict-aliasing? Background: Quoting from AndreyT's answer in http://stackoverflow.com/questions/2771023/c99-strict-aliasing-rules-in-c-gcc/2771041#2771041: "Strict aliasing rules are rooted in parts of the standard that were present in C and C++ since the beginning of [standardized] times. The clause that prohibits accessing object of one type through a lvalue of another type is present in C89/90 (6.3) as well as in C++98 (3.10/15). ... It is just that not all compilers wanted (or dared) to enforce it or rely on it." Well, gcc is now daring to do so, with its -fstrict-aliasing switch. And this has caused some problems. See, for example, the excellent article http://davmac.wordpress.com/2009/10/ about a Mysql bug, and the equally excellent discussion in http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html. Some other less-relevant links: http://stackoverflow.com/questions/1225741/performance-impact-of-fno-strict-aliasing http://stackoverflow.com/questions/754929/strict-aliasing http://stackoverflow.com/questions/262379/when-is-char-safe-for-strict-pointer-aliasing http://stackoverflow.com/questions/725138/how-to-detect-strict-aliasing-at-compile-time So to repeat, do you have a horror story of your own? Problems not indicated by -Wstrict-aliasing would, of course, be preferred. And other C compilers are also welcome.

    Read the article

  • where is c function attribute set (how to unset) with gcc

    - by cvsdave
    I am working with code from the GNU core utils, and find that the void usage() function is apparently set with the attribute "noreturn". Well, I am modifying the function, and I wish it to return (I removed the call to exit()). The compiler still complains that a "noreturn" function returns, and when using the Eclipse CDT debugger, stepping thorugh the code is anomolous - I skip over lines of code. I do not see the function be set in the .c file, and there is no .h file for this .c file. The file is df.c. I have renamed the file df_call.c. How can the compiler be finding this attribute? How can I unset it? Thanks. ======= Thanks to all contributors for their help! The short answer is "the usage() function found in GNUutils 7.4 is prototyped in system.h as 'void usage (int status) ATTRIBUTE_NORETURN'. Changing to 'void usage (int status); /*ATTRIBUTE_NORETURN;*/' resolved the issue for me, but leaves the problem of a modified system.h. The long answer is: The GNU c compiler supports assigning attributes to functions (see http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html) one of which is "noreturn". The syntax is "attribute ((noreturn))" (see http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax) but is often macro'd to ATTRIBUTE_NORETURN. If the attribute is set, and in this case one tries to return from the function, the executable compiles with a complaint, but compiles and runs. It will, however, behave unexpectedly (skipping over src lines in my case, maybe due to the optimization). The debugger in Eclipse CDT actually jumps past lines of code, leading the developer to doubt his senses.

    Read the article

  • difference between C(gcc 4.3.2) , C 99 strict(gcc 4.3.2) , C++(gcc-4.0.0-8) ,C++(gcc-4.3.2)

    - by user1139048
    I have the following questions concerning the differences between the four options: What is the main difference between the four options? Which of the above support int64_t or long long without suffix LL. I want a data type of the range 2^63 - 1 If your answer to my second question is not C(gcc 4.3.2) , whether the code I write in C(gcc 4.3.2) for C language will be valid in rest of the three options or do I have to modify something, then what will be those modifications.

    Read the article

  • GCC vs Microsoft : Undefined reference to `_chkstk'?

    - by SethCoder
    I am using CodeBlocks and MinGW toolchain which is essentially GCC. I was using VStudio but I want to get away from it to do cross platform development. There seems to be some microsoft specific references in some libraries that I am linking, specifically in CXImage SDK (_chkstk). I presume the library was put together using VS. From my searches I have learned that GCC uses _alloca rather than _chkstk. I still want to use CXImage for some stuff I am doing. My question: Is there a way around this problem or am I stuck with ditching libs such as this if I want to use GCC?

    Read the article

  • #pragma init and #pragma fini using gcc compiler on linux

    - by Josh
    I would like to build some code which calls some code on loadup of the shared library. I thought i would do it like this: #pragma init(my_init) static void my_init () { //do-something } int add (int a,int b) { return a+b; } So when i build that code with gcc -fPIC -g -c -Wall tt.c It returns gcc -fPIC -g -c -Wall tt.c tt.c:2: warning: ignoring #pragma init tt.c:4: warning: ‘my_init’ defined but not used So its warning my #pragmas. I tried this in real code and my code aborted because a function hadn't been called in the pragma section because it was ignored. How do i get gcc to use these #pragma init and fini statemets?

    Read the article

  • pow doesn't accept the second parameter to be a variable on gcc

    - by Daziplqa
    pow doesn't accept the second parameter to be a variable on gcc The following code works fine on VC++10 // file test.cc #include "stdafx.h" #include <stdio.h> #include <math.h> int main(void) { double x = 10; int y = 20; printf("%f\n", pow(x, y)); return 0; } But the following code doesn't not work on gcc: // test.c #include <stdio.h> #include <math.h> int main(void) { double x = 10; int y = 20; printf("%f\n", pow(x, y)); // error here, says no such function, however when pass the second argument in `pow` for the code runs by gcc, It works fine! return 0; }

    Read the article

  • gcc std=gnu++0x option

    - by Neeraj
    Hi everyone, I need to compile a C++ code that uses std=gnu++0x option to the g++ compiler in the Makefile.am , As this option is compatible only with gcc 4.3 and above, the build crashes on my machine where i have gcc 4.2. What are my alternatives ? I tried removing that option from the Makefile.am but that reports some other error. Do i need to install gcc 4.3 or above? How can I do it in ubuntu hardy through apt-get ? Thanks.

    Read the article

  • Mac OS X 10.9 with GCC 4.7.3, stdlib.h: no such file or directory

    - by Leon Kaihua Li
    I'm doing some development with C++ on Mac OS. The code worked fine on Mac OS 10.8.3/10.8.4, with GCC 4.7.3. However recently I upgraded my OS to Mavericks 10.9 and Xcode 5.0. I find that when I try to compile my code, both gcc/g++/clang responds with: *******.C:1:** stdlib.h:no such file or directory *******.C:2:** iostream.h:no such file or directory Since I'm not familiar with Mac OS(My working platform is openSUSE), what can I do for it? will it help if I install "Command Line Tools" from Xcode? Or is there anyway that I could re-build the include index? Include dir of GCC is /opt/local/include/gcc47 and it seems there is a stdlib.h in it. The path is /opt/local/include/gcc47/c++/tr1/ Please help me, and thank you very much.

    Read the article

  • Using the "naked" attribute for functions in GCC

    - by Art Spasky
    GCC documentation (http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html) states in 6.29 Declaring Attributes of Functions "naked Use this attribute on the ARM, AVR, IP2K, RX and SPU ports to indicate that the specified function does not need prologue/epilogue sequences generated by the compiler. It is up to the programmer to provide these sequences. The only statements that can be safely included in naked functions are asm statements that do not have operands. All other statements, including declarations of local variables, if statements, and so forth, should be avoided. Naked functions should be used to implement the body of an assembly function, while allowing the compiler to construct the requisite function declaration for the assembler." Can I safely call functions using C syntax from naked functions, or only by using asm?

    Read the article

  • 2-byte (UCS-2) wide strings under GCC

    - by Seva Alekseyev
    Hi all, when porting my Visual C++ project to GCC, I found out that the wchar_t datatype is 4-byte UTF-32 by default. I could override that with a compiler option, but then the whole wcs* (wcslen, wcscmp, etc.) part of RTL is rendered unusable, since it assumes 4-byte wide strings. For now, I've reimplemented 5-6 of these functions from scratch and #defined my implementations in. But is there a more elegant option - say, a build of GCC RTL with 2-byte wchar-t quietly sitting somewhere, waiting to be linked? The specific flavors of GCC I'm after are Xcode on Mac OS X, Cygwin, and the one that comes with Debian Linux Etch.

    Read the article

  • dll runtime error(C/C++/GCC/MSVC)

    - by coanor
    After two days fighting, I make the dll(compiled in GCC/G++) link correctly in MSVC, but while debuging, I got the runtime error, is say that: Runtime Error! Program: my_exe.exe This application has required the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. I have test something in that way: compiled a dll in mingw/gcc, link and debug in MSVC, it works correctly ,but while I implement it in my large project, I got the runtime error. And I tested the dll in mingw/GCC, it works correctly, it says that the runtime error does not come from programming error,it comes from the dll imcompatible between different platform. Does anyone can hele me? Thanks, forgive my poor English.

    Read the article

  • emerge only prints it's parameters along with "Wrong gcc version" message.

    - by Dmitriy Matveev
    Our gentoo server has been left in inconsistent state. I don't know what have been done wrong previously, but now I need to fix the system somehow. I've tried to do revdep-rebuild, but it has failed: ... x11-libs/gksu:0 x11-libs/gtk+:2 x11-libs/gtkglarea:2 x11-libs/libgksu:2 x11-libs/libsvg-cairo:0 x11-libs/qt-gui:4 .......... IMPORTANT: 12 news items need reading for repository 'gentoo'. Use eselect news to read news items. Calculating dependencies... done! emerge: there are no ebuilds to satisfy "gnome-base/gswitchit-plugins:0". emerge: searching for similar names... emerge: Maybe you meant any of these: gnome-base/gswitchit-plugins, gnome-extra/gswitchit-plugins, gnome-base/nautilus? IMPORTANT: 12 news items need reading for repository 'gentoo'. Use eselect news to read news items. revdep-rebuild failed to emerge all packages. you have the following choices: If emerge failed during the build, fix the problems and re-run revdep-rebuild. Use /etc/portage/package.keywords to unmask a newer version of the package. (and remove 5_order.rr to be evaluated again) Modify the above emerge command and run it manually. Compile or unmerge unsatisfied packages manually, remove temporary files, and try again. (you can edit package/ebuild list first) To remove temporary files, please run: rm /var/cache/revdep-rebuild/*.rr I've tried to remove one of the mentioned packages: harley ~ # emerge -C gswitchit-plugins Wrong gcc version = echo -C gswitchit-plugins harley ~ # I don't see any problems with the gcc, but emerge isn't working: harley ~ # gcc --version gcc (Gentoo 4.5.2 p1.0, pie-0.4.5) 4.5.2 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. harley ~ # gcc-config -l [1] i686-pc-linux-gnu-3.3.6 [2] i686-pc-linux-gnu-3.4.6 [3] i686-pc-linux-gnu-3.4.6-hardened [4] i686-pc-linux-gnu-3.4.6-hardenednopie [5] i686-pc-linux-gnu-3.4.6-hardenednopiessp [6] i686-pc-linux-gnu-3.4.6-hardenednossp [7] i686-pc-linux-gnu-4.1.2 [8] i686-pc-linux-gnu-4.5.2 * harley ~ # emerge --help Wrong gcc version = echo --help harley ~ # which emerge /root/bin/emerge harley ~ # emerge Wrong gcc version = echo harley ~ # emerge fdslkgj Wrong gcc version = echo fdslkgj harley ~ # How can I fix emerge?

    Read the article

  • How to build a self-sufficient gcc/glibc/binutils set in a non-standard path?

    - by netvope
    Suppose a set of custom-built gcc/glibc/binutils are in $prefix (e.g. /home/user/path) I want: gcc to look for libraries in $prefix/lib64 instead of /lib64 gcc to look for headers in $prefix/include instead of /include to use $prefix/lib64/ld-linux-x86-64.so.2 as the (hard-coded) loader path instead of /lib64/ld-linux-x86-64.so.2 the dynamic loader to look for shared libraries in $prefix/lib64 instead of /lib64 How should I configure the builds? Do I need to modify gcc's specs file or do anything else?

    Read the article

  • How to cross-compile programs for the Raspberry Pi with gcc?

    - by InkBlend
    I am fond of using gcc to compile small little C and C++ programs on my main computer. However, I also have a Raspberry Pi, and, being a 700-MHz single-core computer, I would prefer to not have to do my development work on it every time I want to create a binary for it. How (for I know that there's a way) do I cross-compile my program for the Raspberry Pi using my x86 laptop? And is there a way that I may compile C(++) programs on the Pi but produce an x86 binary? If it's any help, "The SoC is a Broadcom BCM2835. This contains an ARM1176JZFS, with floating point..." (according to the official Raspberry Pi FAQ).

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >