gcc

Does gcc's STL support rvalue references now?

I know Visual Studio 2010's standard library has been rewritten to support rvalue references, which boosts its performance considerably. Does the standard library implementation of gcc 4.4 (and above) support rvalue references? ...

How to deprecate a macro in GCC?

Hi, i Know how to use attribute deprecated to deprcate a function like this: int old_fn () __attribute__ ((deprecated)); But how to deprecate a Macro like this: #define OLD_MACRO 1 Thank you in advance. Eric ...

Compile for freestanding environment with GCC

The code I'm working on is supposed to be possible to build for both hosted and freestanding environments, providing private implementations for some stdlib functions for the latter case. Can I reliably test this with just GCC on a normal workstation/build server? The "-ffreestanding" option looked promising, but it seems that it "on...

GNU ld removes section

I'm writing a boot script for an ARM-Cortex M3 based device. If I compile the assembler boot script and the C application code and then combine the object files and transfer them to my device everything works. However, if I use ar to create an archive (libboot.a) and combine that archive with the C application there is a problem: I've ...

Where can I download GCC binaries for windows?

I want to play around with GCC 4.5 but on GCC's site it says that they don't supply binaries. I think downloading the source and building GCC from scratch is a bit of overkill (even if the OS, I'm using, Windows, is rather obscure). Where can I download GCC 4.5 for Windows? (I don't want all of Cygwin, just GCC) ...

Output of gcc -fdump-tree-original

If I dump the code generated by GCC for a virtual destructor (with -fdump-tree-original), I get something like this: ;; Function virtual Foo::~Foo() (null) ;; enabled by -tree-original { <<cleanup_point <<< Unknown tree: expr_stmt (void) (((struct Foo *) this)->_vptr.Foo = &_ZTV3Foo + 8) >>> >>; } <D.20148>:; if ((bool) (__in_chrg ...

C/C++: Passing a structure by value, with another structure as one of its members, changes values of this member's members.

Sorry for the confusing title, but it basically says it all. Here's the structures I'm using (found in OpenCV) : struct CV_EXPORTS CvRTParams : public CvDTreeParams { bool calc_var_importance; int nactive_vars; CvTermCriteria term_crit; CvRTParams() : CvDTreeParams( 5, 10, 0, false, 10, 0, false, false, 0 ), ca...

Where is gcc on OSX? I have installed Xcode already

I have installed Xcode from the Tool cd, I thought that would let me use gcc from the command line but I can't find it. What am I missing EDIT When I wrote I can't find it I meant "I look for it using which gcc" If gcc would have been in the PATH in first place, which would have find it. Since gcc is not in the PATH ( that's what...

What is weird about wrapping setjmp and longjmp?

Hello. I am using setjmp and longjmp for the first time, and I ran across an issue that comes about when I wrap setjmp and longjmp. I boiled the code down to the following example: #include <stdio.h> #include <setjmp.h> jmp_buf jb; int mywrap_save() { int i = setjmp(jb); return i; } int mywrap_call() { longjmp(jb, 1); printf(...

looser throw specifier for in C++

I am getting an error that says: error: looser throw specifier for 'virtual CPLAT::CP_Window::~CP_Window()' On the destructor, I have never heard of this before and some Google Searches say this might be a GCC 4 problem, which I would not be sure how to work around since I need GCC 4 to build a Universal Binary. My Environment: OS X 1...

gcc memory alignment pragma

hello. Does gcc have memory alignment pragma, akin #pragma vector aligned in Intel compiler? I would like to tell compiler to optimize particular loop using aligned loads/store instructions. to avoid possible confusion, this is not about struct packing. e.g: #if defined (__INTEL_COMPILER) #pragma vector aligned #endif for (in...

Potential problems porting to different architectures

I'm writing a Linux program that currently compiles and works fine on x86 and x86_64, and now I'm wondering if there's anything special I'll need to do to make it work on other architectures. What I've heard is that for cross platform code I should: Don't assume anything about the size of a pointer, int or size_t Don't make assumption...

Handling responses in libcurl

i have a code to send a Form Post with login credentials to a webpage. it looks like this CURL *curl; CURLcode res; struct curl_httppost *formpost=NULL; struct curl_httppost *lastptr=NULL; struct curl_slist *headerlist=NULL; static const char buf[] = "Expect:"; curl_global_init(CURL_GLOBAL_ALL); /* Fill in the username ...

Cross compile windows 64 bit .exe from linux

I know that if I want to compile a 32 bit .exe for windows on Linux I can just install and use the mingw32 package (e.g. apt-get install mingw32) on linux. What if I want to compile a windows .exe that is 64 bit? Is there tools or a method to do this? ...

Adding icon to gcc executable and opening in terminal.

I made a program to connect to a device via Bluetooth and send the data to the web using pure C in gcc. I won't be able to implement any GUI portion in the code right now but I need to deploy it to test users for testing. I want to have the executable with an icon so that a user can click on the executable and the program starts in the t...

C file read leaves garbage characters

Hi. I'm trying to read the contents of a file into my program but I keep occasionally getting garbage characters at the end of the buffers. I haven't been using C a lot (rather I've been using C++) but I assume it has something to do with streams. I don't really know what to do though. I'm using MinGW. Here is the code (this gives me ga...

Making a Ubuntu executable.

i have made a program in C using the gcc compiler. Right now it has no GUI components. So, I am basically compiling it with makefile and running it in the terminal. I need to deploy it so that the executable is standalone. So, basically I want the executable to have an icon and when clicked start the program in the terminal. Can anyone t...

Strange error(dereferencing pointer to incomplete type)

void get_cwd(char* buf) { char *result; current->fs->pwd; result = get_dentry_path(current->fs->pwd); memcpy(buf, result, strlen(result)+1); kfree(result); } error: dereferencing pointer to incomplete type The error points to current->fs->pwd; includes: #include <asm/stat.h> #include <linux/fs.h> #include <linux...

Removing trailing newline character from fgets() input

i am trying to get some data from the user and send it to another function in gcc. the code is something like this. printf("Enter your Name: "); if(!(fgets(Name, sizeof Name, stdin) != NULL)) { fprintf(stderr, "Error reading Name.\n"); exit(1); } However, i find that it has an \n character in the end. so if i e...

How to use ccache selectively?

I have to compile multiple versions of an app written in C++ and I think to use ccache for speeding up the process. ccache howtos have examples which suggest to create symlinks named gcc, g++ etc and make sure they appear in PATH before the original gcc binaries, so ccache is used instead. So far so good, but I'd like to use ccache onl...