gcc

Compiling a DLL with gcc

Sooooo I'm writing a script interpreter. And basically, I want some classes and functions stored in a DLL, but I want the DLL to look for functions within the programs that are linking to it, like, program dll ---------------------------------------------------- send code to dll-----> parse code ...

Difference between -Wconversion between gcc and g++

Consider the following test program: static void func(int a) { } int main() { unsigned int b = 42; func(b); return 0; } Compiling it with gcc: lol@mac:~/projects$ gcc -Wconversion testit.c testit.c: In function âmainâ: testit.c:11: warning: passing argument 1 of âfuncâ as signed due to prototype lol@mac:~/projects$ ...

GCC 4.0: "no matching function to call" in template function

Hi, I am wondering why the following contrived example code works perfectly fine in Visual Studio 2005, but generates an error in GCC ("no matching function to call" when calling Interpolate() as shown below). Also, how do I work around this? It seems that the error message is just a generic message because GCC did not have a more spe...

Any improvements on the GCC/Windows DLLs/C++ STL front?

Yesterday, I got bit by a rather annoying crash when using DLLs compiled with GCC under Cygwin. Basically, as soon as you run with a debugger, you may end up landing in a debugging trap caused by RtlFreeHeap() receiving an address to something it did not allocate. This is a known bug with GCC 3.4 on Cygwin. The situation arises because ...

Why does GCC look at private constructors when matching functions?

I'm very busy write now debugging some code, so I can't cookup a complete example, but this basically describes my problem class Base{}; class MyX:public Base { ... }; class Derived:Base { ... }; template<class X> class MyClass:Derived { private: MyClass(const MyClass& ) :x() {} public: MyClass(const X& value) :x(...

C program compiled with cygwin in Windows works, segmentation fault under Linux. Is cygwin GCC 'bad'?

For my Programming 102 class we are asked to deliver C code that compiles and runs under Linux. I don't have enough spare space on my hard drive to install Linux alongside Windows, and so I use cygwin to compile my programs. The most recent program I had to give in compiles and runs fine under cygwin. It compiles fine under Linux, but h...

How to build Apple's GCC on Linux/Windows?

I don't have a Mac, but I have an iPhone. I want to develop applications for iPhone. After some research I think I need just the headers and library from the free SDK, and a GCC build that supports ARM/Mach-O. Apple released the code for GCC used in the iPhone SDK (they had to), So I think if I could build it on Windows or Linux, I can u...

compiling c++ applications so they can work on other computers as well

So I have this very simply SDL application I want to be able to pass to my friend without having him download a whole bunch of SDL packages. how can I go about this? I was told to use this line to compile: (note that I use ubuntu linux and so does my friend, and that this application compiles and runs without the "-Wl,-Bstatic" options...

Can I control register allocation in g++?

I have highly optimized piece of C++ and making even small changes in places far from hot spots can hit performance as much as 20%. After deeper investigation it turned out to be (probably) slightly different registers used in hot spots. I can control inlineing with always_inline attribute, but can I control register allocation? ...

Any way to disable `tempnam' is dangerous, better use `mkstemp' gcc warning?

I'm using tempnam() only to get the directory name, so this security warning does not apply to my case. How can I disable it? I couldn't find any switches to do it. ...

Does gcc work when the wrapper is a different version than the platform-specific binary?

The way I understand gcc, /usr/bin/gcc (and other bits related to gcc, like ld) is a small wrapper that delegates to a platform-specific binary somewhere else on the system. So does compilation still work correctly if you have a cross compiler that is a couple of versions behind /usr/bin/gcc? ...

Calculate SLOC GCC C/C++ Linux

Hi, We have a quite large (280 binaries) software project under Linux and currently it has a very dispersed code structure - that means one can't [work out] what code from the source tree is valid (builds to deployable binaries) and what is deprecated. But the Makefiles are good. We need to calculate C/C++ SLOC for entire project. Here...

Why does gcc have "â" in all its error messages?

For some reason, my installation of gcc seems to be printing an "a with a carat" character in place of all %s's in its error messages, e.g., test.c:4: error: expected â, â, â, â or â before â token Has anyone else seen this before? (Needless to say, it's difficult to Google for.) (This is on Ubuntu 8.10) Edit: The guy at http://ubun...

Is the "empty base optimization" in GCC configurable?

Consider these types: struct A {}; struct B : A { int i; }; sizeof(A) > 0 as required by the standard. sizeof(B) should be 4 due to the empty base optimization. Yet on GCC 4.1.1 it's 5 (I'm using a pack of 1 in this area). And inconsistently - some of my files are getting it, some are not. Can't be sure what the differences are y...

How to create a shared object that is statically linked with pthreads and libstdc++ on Linux/gcc?

How to create a shared object that is statically linked with pthreads and libstdc++ on Linux/gcc? ...

How to use address constants in GCC x86 inline assembly

The GCC toolchain uses AT&T assembler syntax by default, but support for Intel syntax is available via the .intel_syntax directive. Additionally, both AT&T and Intel syntax are available in a prefix and a noprefix version, which differ in whether or not they require to prefix register names with a % sigil. Depending on which directives...

Is Objective-C 2.0 exception handling supported on non Mac OS X platforms?

Objective-C 2.0 has some new enhancements: garbage collection fast enumeration: for..in properties thread synchronization: @synchronized(self) @try/@catch/@finally/@throw exception handling I'm interested in using Objective-C 2.0 as a language to program portable code across multiple operating system platforms - while avoiding framew...

Help on Compiling on AIX

Hi All, Is there a site where I can find the symbols used in a particular library and its version. For e.g. I m trying to compile some code on AIX using gcc, and it throws me a lot of undefined symbol errors For example, here is an output: ld: 0711-317 ERROR: Undefined symbol: .__fixdfdi ld: 0711-317 ERROR: Undefined symbol: .__divdi3 ...

How to add a default include path for gcc in linux?

I'd like gcc to include files from $HOME/include in addition to the usual include directories, but there doesn't seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include directory at command line when compiling (or in the makefile), but I'd really like a universal approach here, as in the library case. ...

gcc equivalent of VC++ warning C4018: signed/unsigned mismatch

Is there a gcc equivalent of VC++ warning C4018: signed/unsigned mismatch? We have an automated build on windows which runs with /WX and I'd like to be able to catch those warnings when building on Linux as well. ...