gcc

Where is the gcov symbols?

I'm trying to compile a simple app with gcov and getting the following link errors: gcc AllTests.o CuTestTest.o CuTest.o -o TestTest AllTests.o: In function `global constructors keyed to 0_RunAllTests': /home/p7539c/cutest/AllTests.c:26: undefined reference to `__gcov_init' AllTests.o:(.data+0x44): undefined reference to `__gcov_merge_a...

What's your favorite g++ option?

Hi, I am a newbie in C++ programming. When compiling I never use any option. This is my day to day command: g++ MyCode.cc -o MyCode For safety practice what's the best option to use? ...

How to compile a C program?

I haven't done C in a long time. I'd like to compile this program, but I have no idea how to proceed. It seems like the makefile refers to GCC a lot and I've never used GCC. I just want an executable that will run on windows. ...

Is there a way to include a header in every compilation unit without modifying every source file?

Given the following: large project with thousands of C++ source files no common header file (no one header that's included in every source file) said project is compiled with g++ and managed by make Is there any way to include a definition (e.g. macro) into every compilation unit without modifying every source file to include a new h...

Why can't gcc find the random() interface when -std=c99 is set?

I do "#include <stdlib.h>" at the top of the source. Example compilation: /usr/bin/colorgcc -std=c99 -fgnu89-inline -g -Wall -I/usr/include -I./ -I../ -I../../ -I../../../ -I../../../../ -O3 -o f8 f8.c In file included from f8.c:7: ctype-cmp.c: In function ‘randomized’: ctype-cmp.c:48: warning: implicit declaration of function ‘ra...

Compiling with operator() under GCC 3.3 Problem in Boost

Hi, I have the following snippet: #include <boost/random/lognormal_distribution.hpp> #include <boost/random/lagged_fibonacci.hpp> int main() { const double mean = 0.0; const double sigma = 1.0; boost::lognormal_distribution<double> lognorm_dist(mean, sigma); boost::lagged_fibonacci44497 engine; // the following line giv...

WxWidgets / GCC / MacOs X: How can I build and link the WxWidgets library properly?

Hi, I am trying to port a windows application based on WxWidgets 2.8.9 to MacOS X. I've gotten to the point where everything compiles successfully, except from a few missing symbols related to WxWidgets. I've tried compiling WxWidgets with the command line and with XCode and I've tried several different configuration options, but none o...

C++ template : OKay for VC2005SP1, gcc bails out !?

Hi, I'm puzzled here, and kindly request your help. VC2005SP1 swallows this (stripped out) code but gcc 4.0.1 bails out... Please point me the obvious mistake ? TIA! template<typename BCT, typename UIDT> class Factory { public: template<typename CT> bool Register(UIDT UniqueID) { if (UniqueID > 10) return(false)...

XCode: Does my program crash even before reaching main()?

Hi, I am trying to port a project including both SDL and WxWidgets to MacOS X with XCode 3.1.2. The project is fairly big, but I finally got it to compile successfully. However, it exits immediately after starting it with the message "MyApplication has exited with status 99". For debugging purposes, I changed my main function to look ...

XCode Debugger: Code window does not match stack window

Hi, I'm trying to port a fairly large windows project based on SDL and WxWidgets to MacOs X. For the first time ever on a Mac, I can run my application, but the debugger does not seem to work properly. When breaking into my application, the stack view seems to make sense, but when I click on one of the function names shown in the debu...

GCC without Xcode on OS X

I've just unwrapped my new MacBook Pro (yay!) and am now setting it up properly for development. Since I want to avoid clutter, I'm wondering if I really need to install the Xcode tools at all (I never use the IDE or Mac specific tools), since I'll install a newer version of GCC anyway, using MacPorts. So, is there any benefit in instal...

Solaris pstack output: what does "SYS#0" mean?

I encountered "SYS#0" at the top of a stack and cannot find any documentation as to what that means. Compiler: g++ OS: Solaris 9 Arch: SPARC Memory Manager libhoard_32.so from Hoard 3.5.1 We used "gcore" to generate a core file. Looking at the output of running the "pstack" command against the core file, the only thread that was doin...

STL iterator with custom template

Hi, i have the following template method, template <class T> void Class::setData( vector<T> data ) { vector<T>::iterator it; } and i'm getting the following compilation error ( XCode/gcc ) error: expected `;' before 'it' i found someone else with a similar problem here (read down to see it's the same even though it star...

GCC debugger stack trace displays wrong file name and line number

Hi, I am trying to port a fairly large C++ project to using g++ 4.0 on MacOS X. My project compiles without errors, but I can't get gdb to work properly. When I look at the stack by typing "bt" on the gdb command line, all file names and line numbers displayed are wrong. For example, according to the gdb stack trace, my main() functio...

Building crti.o for i386

I am trying to build a cross-compiler with x86_64 being the host and i386 being the target. I'm getting the (all to common) crti.o: No such file error. Instead of grabbing an already built crti.o and crtn.o from a distro... how might I go about building these files explicitly from glibc (or possibly gcc) sources? FYI, I am well aware of...

Template Function under GCC

Duplicate. See this. Can someone tell me why this does not compile under GCC? Both MSVC6, and VS2008 will compile it, with no warnings, even. The code... #include <iostream> #include <vector> #include <ctime> #include <cstdlib> using namespace std; template <typename T> T range(vector<T> &v) { vector<T>::iterator i = v.begin(); ...

How to compile simple C file using GNU C Compiler/gcc & Mobile-Terminal on the iPhone?!

How to compile simple C file using GNU C Compiler/gcc & Mobile-Terminal on the iPhone?! Do I need extra files? ...

GCC / C how to hide console window?

**C newbie alert** How do I compile a C app so that it runs without showing a console window on Windows? I'm using Windows XP and GCC 3.4.5 (mingw-vista special r3). I've googled this exhaustively and I've come up with the following which, according to what I've read, sounds like it's supposed to do the trick, but doesn't on my system:...

GCC on Windows: Set "Description" field of C executable?

**C Newbie Alert** How does one set the "Description" property of an executable? By this I mean the value displayed when you right-click an executable in Windows Explorer and it shows "Description:" with what seems to be just the name of the executable without the file extension. I'm running GCC 3.4.5 (mingw-vista special r3) on Window...

"multiple types in one declaration" but no ; missing.

I tried to compile my program, with Code::Blocks (gcc compiler). And I get an error: Here is the source file it complaining about: #ifndef BOT_H #define BOT_H #include "player.h" #include "timer.h" class BOTS; // forward decalaration of BOTS class BOT : public PLAYER { public: enum BotStatus{BotMoving,BotPursue,BotChasePowerup}; ...