gcc

External Libary

How do you make .h files globally accessible by for example #include ? If its compler specific either migw or gcc. C++ ...

GCC virtual memory exhausted: Permission denied

I'm trying to compile a particular .cpp file in a large project, and I'm getting the following error from GCC: virtual memory exhausted: Permission denied The file in question is ~25k in size, and less than 600 lines of C++ code. I understand what it means to run out of virtual memory, but I'm not sure what the "Permission denie...

Add GCC options to top of C source file

Is is possible to put something at the top of the C source file, like // GCC_OPTIONS=-g,-Wall that will add those options automatically to gcc every time you compile this file? ...

Require return type of function template to be specialization of a template

I've poked around on stackoverflow for a while, but either I don't understand templates enough to find a solution, or it simply hasn't been answered before. In this example: template <typename T> T f(); Is it possible to make the function require type T to be a specialization of the std::basic_string template? I could have the templ...

Undefined reference to operator new

I'm trying to build a simple unit test executable, using cpputest. I've built the cpputest framework into a static library, and am now trying to link that into an executable. However, I'm tied into a fairly complicated Makefile setup, because of the related code. This is my command line: /usr/bin/qcc -V4.2.4,gcc_ntoarmle_acpp-ne -lang...

Compiling C in Windows XP

Hi, I want to learn Vim editor and I'm trying to compile a C file. I've installed MinGW and I've added gcc.exe to System Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Arquivos de programas\TortoiseSVN\bin;c:\Arquivos de programas\Microsoft SQL Server\100\Tools\Binn\;c:\Arquivos de programas\Microsoft SQL Server\...

Variable declaration question

Hi, I have the following declaration in my code: u32 volatile __attribute__((nocast)) *A, *B; Is this equivalent to: u32 volatile __attribute__((nocast)) *A; u32 volatile __attribute__((nocast)) *B; or: u32 volatile __attribute__((nocast)) *A; u32 volatile *B; or even: u32 volatile __attribute__((nocast)...

gcc compiled binaries give "cannot execute binary file"

Hi- I compile this program: #include <stdio.h> int main() { printf("Hello World!"); return 0; } With this command: gcc -c "hello.c" -o hello And when I try to execute hello, I get bash: ./hello: Permission denied Because the permissions are -rw-r--r-- 1 nathan nathan 856 2010-09-17 23:49 hello For some reaso...

Compiling a fat executable with gcc

This is not essential for my programs, but merely out of curiosity. Is it possible to, preferably using gcc, compile a 'fat' binary for Linux including multiple architectures such as combinations of amd64, i386, lpia and powerpc? ...

Tools/techniques for diagnosing C app crash on Windows

I have written an application in C, which runs as a Windows service. Most users can run the app without any problems, but a significant minority experience crashes caused by an Access Violation, so I know I have a bug somewhere. I have tried setting up virtual machines to mirror the users' configurations as closely as possible, but canno...

TARGET_OS_IPHONE and ApplicationTests

Why doesn't this code work when compiling an ApplicationTests unit test bundle? #if TARGET_OS_IPHONE #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #else #import <Cocoa/Cocoa.h> #endif One of my dependencies has this check and compiles just fine in my main application bundles, but it tries to load <Cocoa/Cocoa.h> w...

How to compile from gVim on Windows with GCC from Cygwin and then run the program?

I've been working at this all morning and I still can't find a way to easily bind a key to compile my program from the Windows version of gVim using the Cygwin GCC, and then run it. I'm kind of a novice to Bash scripting, and I haven't been able to make it create the .exe in the home directory (C:/cygwin/home) and then run it. What I h...

Where is a binary file once it's been built (for ffmpeg)?

I need to build ffmpeg for Mac for converting MOV to FLV in a Java application. I made and installed LAME and then FFMPEG, but I'm confused as to what file I should grab to include with the Java application. What is the binary file? The previous version that I grabbed from the source of ffmpegX was 10mb in size, but the file that's in my...

How can I check with which options was program compiled?

Hi, I would like to know options which where passed to program before make, which is currently installed on my Ubuntu (from deb). I would like to compile it manualy with the same options (+ some extra). ...

How to suppress boost::thread warnings with gcc ?

Hi, In my project, I recently decided to use boost::thread. My code compiles fine under Linux, but under Windows (either x86 or x64), I get the following warnings with gcc 4.5: In file included from C:\Boost\include\boost-1_44/boost/thread/shared_mutex.hpp:14:0, from C:\Boost\include\boost-1_44/boost/thread/detail/thre...

GCC vs MS C++ Compiler

I often read that the GCC compiler is much better than the Microsoft compiler on various forums and comment thread. This is always because "Micro$oft is evil" and that GCC is open-source. Are there any technical reasons that GCC is better? Are there any scenarios where one would want to use GCC over MS for windows development? Are there ...

SSE4.1 intrinsics compilation error on Mac

I'm having some trouble using SSE4.1 intrinsics on hardware that (I think) supports it. Can anyone tell me if I've missed something? Building the following code on a MacBookPro5,4 (Penryn): >g++ -msse sse4.cpp -S -o sse4.asm #include <stdio.h> #include <smmintrin.h> int main () { __m128 a, b; const int mask = 0x55; a.m1...

Compile C++ file under linux

I am tring to compile and my C++ program on Linux using gcc command. I used gcc -lm MyOwn.c Main.c -o Out Myown.c is another file I should link to the main. The Out file is successfully created. The problem is Out does not run. When I tried to use gcc or cc to create exe file it gives me a lot of errors Can someone help me? ...

Linking phase in distcc

Is there any particular reason that the linking phase when building a project with distcc is done locally rather than sent off to other computers to be done like compiling is? Reading the distcc whitepages didn't give a clear answer but I'm guessing that the time spent linking object files is not very significant compared to compilation....

Contents of a static library

I have a static library, say mystaticlib.a. I want to see its contents, such as the number of object files inside it. How can I do this on gcc? ...