You are not logged in.

#1 2010-06-23 14:23:52

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 876

[SOLVED] How to find included headers?

Hi, I have a C++ program which includes an external header. In this header a class is declared, and some inline members are implemented. When I run my executable it runs strange, in the sense that it seems not to execute the code as specified in the header, but rather behave as an old version of that header. So I was wondering: is it possible, from the binary file, to extract the names of the source files, including headers?
Thanks

Last edited by snack (2010-06-24 16:34:59)

Offline

#2 2010-06-24 08:01:45

PirateJonno
Forum Fellow
From: New Zealand
Registered: 2009-04-13
Posts: 372

Re: [SOLVED] How to find included headers?

I don't think the binary will contain that information (unless it has debug symbols). Usually headers are located in /usr/include, and you could check the makefile for the program to look for other locations/subdirectories


"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page

Offline

#3 2010-06-24 16:15:30

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: [SOLVED] How to find included headers?

If you changed the header, you have to recompile any files that #included that header.  It's also possible that g++ is finding an old version of the header somewhere, so use g++ -v to see what the header search path is.

Offline

#4 2010-06-24 16:34:14

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 876

Re: [SOLVED] How to find included headers?

Thanks, I actually found the problem. The header in question contains an inline method for a class. Then, in another library, I have a function which calls this inline method: the inline code is then compiled and put into this library. Then my main program calls the  function from this library, so changing the code in the header without recompiling the library had no effect on my program. A real noob-error, indeed...
Thank you anyway, PirateJonno and tavianator!

Last edited by snack (2010-06-24 16:34:46)

Offline

Board footer

Powered by FluxBB