gcc

Visual C++ versions of GCC functions

Hi, Are there Visual C++ versions of the following (in GCC)? __builtin_return_address __builtin_frame_address Reference - http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html If not, is there a way to emulate them? Thanks. ...

Using libs/dlls compiled in Linux/MinGW in Visual Studio

Update: I get this warning when compiling: multiple '.text' sections found with different attributes Hi, I've compiled some libraries (.a and .dll) in Linux using the MinGW Cross Compiler. I can successfully link against them (.a) in Visual Studio 2008. However, when it runs (using .dll), it terminates with the address pointer pointing...

Weird duplicate symbol in iPhone sdk project when compiling?

My project was working fine the whole time, today I added an admob library to my project and now it won't compile! Here is the error: ld: duplicate symbol .objc_category_name_NSCharacterSet_NSCharacterSet_Extensions in /Photo/libAdMobSimulator.a(NSCharacterSet_Extensions.o) and /Photo/build/Photo.build/Debug-iphonesimulator/Photo.build...

How to statically link to the CRT with GCC?

Using GCC4 in MAC OSX, Linux and Windows. Thanks. ...

Gcov reporting unexpected cover results

I made some changes to a library to keep it inline with a project. I ran the test and everything still passed but the coverage is no longer 100%. I investigated and saw that the code is executed just not reported. But I have no idea why gcov is not reporting coverage for the line when it is executing. This is the code: int32_t Previous...

Compile and optimize for different target architectures

Summary: I want to take advantage of compiler optimizations and processor instruction sets, but still have a portable application (running on different processors). Normally I could indeed compile 5 times and let the user choose the right one to run. My question is: how can I can automate this, so that the processor is detected at runt...

invalid use of incomplete type in memory allocation wrapper, GCC only ?

Hey all, I am tracking down what might be a memory leak by globally overloading operator new etc... the code to do so compiles fine under VC++, but throws problems in GCC: 15: namespace std { class bad_alloc; }; 16: 17: void * operator new( size_t size ) throw ( std::bad_alloc ); 18: void operator delete( void * p ) throw (); 19:...

g++ "is not a type" error

Writing a templated function, I declared: template <typename T> T invertible(T const& container, T::size_type startIndex, T::size_type endIndex); Compiling with g++ 4.0.1 I got the error: error: 'T::size_type' is not a type ...

How to link to a shared library without lib* prefix in a different directory?

I have to link my code to a shared library without the lib prefix. (say, foo.so) The first problem is -l option does not find the file. So I tried directly including this file to the last compilation like this: gcc a a.o /PATH/TO/FOO/foo.so But in this case, a is hard linked to foo.so as an absolute path as seen in "ldd a": /PATH/TO/...

How to know which optimizations are turned on in gcc ?

Hi, I've seen that you can see the optimizations which are turned on using: gcc -O2 -Q --help=optimizers but the thing is that it only shows optimizations that have a flag. Do you know if there's a way to find the others ? This is maybe stupid since with no flag how would they describe the optimizations...but anyway... ...

How to get the returned value using __cyg_profile_func_exit ?

Hi, Using the instrument-functions flag in gcc, you can instrument the code to execute functions before and after each execution of a function. These functions are __cyg_profile_func_enter and __cyg_profile_func_exit with two parameters, the address of a current function; the second parameter for enter is the address of the call site an...

request for member `...' is ambiguous in g++

I'm getting the following compile error in one of my classes, using gcc 3.4.5 (mingw): src/ModelTester/CModelTesterGui.cpp:1308: error: request for member `addListener' is ambiguous include/utility/ISource.h:26: error: candidates are: void utility::ISource<T>::addListener(utility::IListener<T>*) [with T = const SConsolePacket&] include...

gcc compiler advantage

can anyone tell me what gcc is?? and wts are its advantage over other compiler like turbo c and visual c ...

Compiling C/GTK within Eclipse

I'm fiddling around with the C/C++ version of Eclipse to build a simple GTK app. However, I can't seem to be able to compile a GTK sample from within Eclipse. I can compile a simple Hello World style test app, so I know the tool chain itself is working. However, the moment I start adding GTK into the mix the compiler comes up with errors...

Using Gcc on Win32 and linking to msvcrt.dll

I know microsoft recommends against linking to the msvcrt.dll, so please spare me from that warning. They do it all the time in their software (like WinDbg) and they won't introduce breaking changes since all VC6 apps link against msvcrt.dll. Linking against msvcrt.dll has several benefits. Small executable, easy deployment: msvcrt is t...

GCC: Empty program == 23202 bytes?

test.c: int main() { return 0; } I haven't used any flags (I am a newb to gcc) , just the command: gcc test.c I have used the latest TDM build of GCC on win32. The resulting executable is almost 23KB, way too big for an empty program. How can I reduce the size of the executable? ...

GCC's assembly output of an empty program on x86, win32

I write empty programs to annoy the hell out of stackoverflow coders, NOT. I am just exploring the gnu toolchain. Now the following might be too deep for me, but to continuie the empty program saga I have started to examine the output of the C compiler, the stuff GNU as consumes. gcc version 4.4.0 (TDM-1 mingw32) test.c: int main() ...

charlower with gcc

I am trying to convert the following code from msvc to gcc #define ltolower(ch) CharLower((LPSTR)(UCHAR)(ch)) char * aStr; * aStr = (char)ltolower(*aStr); This code is giving a compiler error: cast from ‘CHAR*’ to ‘char’ loses precision My understanding is that tolower(int) from c wouldn't convert the whole string. Thanks...

what is linux analog to WIN32_FIND_DATA structure

also, how would you build that structure from scratch. What is the fastest way to get the source code of the ls command in linux? Thanks. ...

Different destructor behavior between vc9 and gcc

The following code gives a different number of destructors when compiled on GCC and vc9. AFAIK when run on vc9 i get 5 destructors showing, which I understand. The + overloaded operator is called, and two object are created, when returned a temporary object is created. This makes destruction of 3 objects possible. When the overloaded = o...