gcc

Weird C++ templating issues

So basically the assignment was we had to create a doubly linked list that's templated generically instead of locked to a single data type. I've tried compiling both with gcc and msvc and both compilers are giving me roughly the same errors so I'm assuming its just my bad coding and not the quirkyness of one compiler or the other. Curr...

Migrating g++ to gcc

I have a mixture of c and c++ files compiling under g++. As explained in: http://stackoverflow.com/questions/172587/what-is-the-difference-between-g-and-gcc The c files are being compiled as c++ with the g++ command line. Not huge problem but migrating over to gcc will allow th c files to compile as c files and the c++ file to compile...

Change GCC version used by bjam

I am trying to build a library (luabind) with bjam. I came across an error and it seems like the problem is that I need to compile with gcc 4.2, but the default on this computer (Mac OSX) is 4.0. I would prefer not to go around changing links in system directories, is there a way to specify to bjam to use gcc4.2 rather than just gcc? ...

gcc precision bug?

I can only assume this is a bug. The first assert passes while the second fails: double sum_1 = 4.0 + 6.3; assert(sum_1 == 4.0 + 6.3); double t1 = 4.0, t2 = 6.3; double sum_2 = t1 + t2; assert(sum_2 == t1 + t2); If not a bug, why? ...

More fine-grained behavior of gcc -Wshadow option

Folks, I really like the -Wshadow option since it helps to spot some possible problematic pieces of code. I want to use it in a really large project but I can't since it's too strict. For example it throws a warning for the following case: struct Foo { Foo(int info) : info_(info) {} //shadow warning is here void info(){ ... } int ...

Is it possible to use __func__ in gcc 3.3+ the old way? (C++)

With gcc versions before 3.3 and with the MS compiler I use the following macro: DEBUG_WARNING(...) printf(">WARNING: "__FUNCTION__"() " __VA_ARGS__); Use: DEBUG_WARNING("someFunction returned %d", ret); Output: >WARNING: Class::FunctionName() someFunction returned -1 Its extremely handy when we have lots of systems, all sending...

How can I tell, with something like objdump, if an object file has been built with -fPIC?

How can I tell, with something like objdump, if an object file has been built with -fPIC? Thanks, -Crazy Chenz ...

Help gcc to not warn about not using a string literal format string

I'm creating a function in C to convert an index value into a string, which is a verbose description of the "field" represented by the index. So, I have a nice array with all the verbose descriptions indexed by, well the index. To dump it into a buffer I use code like this #define BUFFER_SIZE 40 void format_verbose(uint32_t my_index, ...

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

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, ste...

What are the pros & cons of pre-compiled headers specifically in a GNU/Linux environment/tool-chain?

Pre-compiled headers seem like they can save a lot of time in large projects, but also seem to be a pain-in-the-ass that have some gotchas. What are the pros & cons of using pre-compiled headers, and specifically as it pertains to using them in a Gnu/gcc/Linux environment? ...

Install stable latest gcc 4.4.x on a workstation (Kubuntu 9.04)

Hi, I wonder how to install a stable latest gcc (4.4.x) for a workstation under Kubuntu 9.04? The reason I need gcc 4.4.x is that I would like to use Collapse in OpenMP 3.0 which is only supported in GCC 4.4 and later version. Stability is important to me since I would like to make it work on a workstation shared by many people at work...

Possible to build a shared library with static link used library?

I can build a executable with gcc with static link: gcc -static xxx.c -o xxx So I can run xxx without any external dependent library. But what if I want to build shared library without externel dependent library? which I mean I want the shared library statically linked its externel reference in. ...

How do I get C++ programs to link with gcc's stack protector feature on AIX?

I'm a bit of an AIX newbie. I'm trying to compile a program using gcc's stack protector feature. I installed gcc on server using pware's GCC package and I can compile a sample program like: #include <stdio.h> int main(int argc,char **argv) { printf("hello world\n"); return 0; } When I turn on stack-protector though, I get: g++ -...

gcc -s and bash command strip

Hi, I wonder what is the difference between these two: gcc -s: Remove all symbol table and relocation information from the executable. strip: Discard symbols from object files. Are they having the same meaning? Which one do you use to reduce the size of executable and speed up its running. Really appreciate your detail info. Thanks...

List of libraries available on a stock installation of OS X?

I'm trying to compile a version of convert (one of the ImageMagick tools) for distribution with a Cocoa app I'm writing, and I've mistakenly bundled a version that relies on shared libraries my users don't have (twice, already). Thus, I'm trying to pare down the list. After stripping out everything I didn't need, running otool -L conve...

"int32 undeclared" gcc error

I'm trying to learn me some C, and have run into what is probably a simple problem. I'm trying to compile some code which contains the following declaration: int32 count; However, this results in an error at compile time: test.c:21: error: ‘int32’ undeclared (first use in this function) Is there a particular compile-time option I ...

GCC array of struct compiler weirdness

I haven't used C in a long time. What's going on here? wOCR.c:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token wOCR.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token on this code: struct wOCR_matchGrid { char character; int * data; }; struct wOCR_matchGrid alphaMatch[26]; ...

Can I install gcc in iPhone with out jailbraking it?

Hey... Is it possible to install gcc in iPhone (3.0 or above) with out jailbraiking it? If yes, Do you know a good place where I should start ?(please don't say "Google it!", lol) If the answer is no. What is the demerit of jailbraking my iphone? or ipod touch? I would like to be able to use gcc inside my app , Thanks in advance. ...

Need an autoconf macro that detects if -m64 is a valid compiler option

I have code that I want to compile on all unix systems, but if -m64 i available and it works, I want the configure script to use it. How do I get autoconf to check to see if -m64 works and, if so, use it? ...

How do I force a 32 bit build of boost with gcc?

How do I force a 32 bit build of boost with gcc? Currently attempting by putting this line in my user-config.jam, but it does not work. using gcc : 4.1.2 : g++ : compileflags="-m32" ; Chenz ...