We use g++ 4.2.4 and I'm trying to track down some performance problems in my code.
I'm running gprof to generate the profile, and I'm getting the following "strangeness" in that the most expensive function is __tcf_0:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds sec...
hey,
I know how to use g++ and all that to compile c++ programs.
My question is, if I have some code which depends on various libraries, how can I compile it into a simple executable that I can send anyone. For this I would be happy with just keeping it on os x.
I would like to know how to compile a "real" program not just an executable...
I have a question. I recently had a class project where I had to make a program with G++. I used a makefile and for some reason it occasionally left a .h.gch file behind. Sometimes, this didn't affect the compilation, but every so often it would result in the compiler issuing an error for an issue which had been fixed or which did not...
Somehow this is the first time I've ever encountered this problem in many years of programming, and I'm not sure what the options are for handling it.
I am in the process of porting an application to Linux, and there is a header file in one of the directories that apparently has the same name as a header file in the standard C library, ...
I use ddd (v3.3.1.1 x86_64-pc-linux-gnu, Ubuntu 9.04) to debug my single-threaded C++ app. The first time through, everything works fine, and I can inspect variables without problems.
Once the app ends, if I try to run it again, my breakpoints are all still there, but all the variables fail to display. Clicking on them results in: "D...
I had the following code, which was basically,
class foo {
public:
void method();
};
void foo::foo::method() { }
I had accidentally added an extra foo:: in front of the definition of foo::method. This code compiled without warning using g++(ver 4.2.3), but errored out using Visual Studio 2005. I didn't have a namespace named ...
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.
...
Hello,
I try to use Eclipse as an IDE for C programming. Hence, I installed cygwin successfully thereby getting gcc,gdb, and make tools. I'm able to execute C programs on cygwin, however I can't do that on Command prompt. I know, there must be a problem related to Path. But I added C:\Cygwin\bin;C:\Cygwin\usr\bin to the path. I double-c...
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...
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...
Hi folks!
I'm trying to use pulseaudio to play the contetst of a vorbis-stream but are hitting problems. Basicly I'm told that:
‘pa_simple’ was not declared in this scope
‘pa_simple_new’ was not declared in this scope
‘pa_simple_write’ was not declared in this scope
Some code are shown below:
#include <pulse/pulseaudio.h>
pa_sim...
The GNU C++ (g++ -pedantic -Wall) accepts this:
typedef int MyInt;
class Test
{
public:
MyInt foo();
void bar(MyInt baz);
};
int Test::foo()
{
return 10;
}
void Test::bar(int baz)
{
}
int main(void)
{
Test t;
t.bar(t.foo());
return 0;
}
Is it legal C++? Are other compilers likely to accept it?
...
Hi all,
I was writing a sample example involving multiple files. The detailed code is as follows.
main.cpp
#include <algorithm>
#include <iomanip>
#include <ios>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
#include "grade.h"
#include "Student_Info.h"
using std::cin;
using std::cout;
using std::domain...
MPICH2 is installed in C:\Program Files\MPICH2. There are two subdirectories (of interest), \include which contains .h files, and \lib which contains .lib files.
The readme that comes with MPICH2 has the following instructions:
create a makefile
add –I…mpich2\include (uppercase i)
add –L…mpich2\lib
add –lmpi (lowercase L)
add the rule...
Hi,
The following code summarizes the problem I have at the moment. My current execution flow is as follows and a I'm running in GCC 4.3.
jmp_buf a_buf;
jmp_buf b_buf;
void b_helper()
{
printf("entering b_helper");
if(setjmp(b_buf) == 0)
{
printf("longjmping to a_buf");
longjmp(a_buf, 1);
}
printf("return...
In a project I'm working on at the office, when we compile a release build (with -Os) we get hundreds of warnings from g++ saying that inlining has failed. Most of these warnings seem to come from boost, however some come from our own library headers (binary .dylibs that we're linking to). Can these warnings generally be safely ignored...
Hello,
example use of "xargs" application in Unix can be something like this:
ls | xargs echo
which is the same as (let's say I have "someFile" and "someDir/" in the working dir):
echo someFile someDir
so "xargs" take its "input" and place it "at the end" of the next command (here at the end of echo).
But sometimes I want xargs to...
Update 3:
Never mind. I kinda got what I was looking for. The following gives unique identifiers inside a class.
static const int _counter_start = __COUNTER__;
static const int val1 = __COUNTER__ - _counter_start;
static const int val2 = __COUNTER__ - _counter_start;
Update 2:
Boost Preprocessor
I will be implementing something ak...
Hi,
I have a class A as follows:
class A
{
public:
A()
{
printf("A constructed\n");
}
~A();
//no other constructors/assignment operators
}
I have the following elsewhere
A * _a;
I initalize it with:
int count = ...
...
_a = new A[count];
and I access it with
int key = ....
....
I have issue that is reproduced on g++. VC++ doesn't meet any problems.
So I have 2 cpp files:
1.cpp:
#include <string>
#include <iostream>
extern const std::string QWERTY;
int main()
{
std::cout << QWERTY.c_str() << std::endl;
}
2.cpp:
#include <string>
const std::string QWERTY("qwerty");
No magic, I just want place string...