|
It could be something in your header file hierarchy. Is a pre-compiled header option available with Builder ?
One thing I am now in the habit of doing (and I get some flak for) is a more proactive form of header inclusion guards. I use an included definition of the form :
#ifndef _INCLUDEFILE_H
#define _INCLUDEFILE_H
...
then I also put this in comments for easy cutting and pasting :
and I use this form whenever I place an include statement in a header whether I am including one of mine or one from the compiler. Always !
Also - I usually take this even a bit farther. I make it a fatal error if a file is repeatedly included and this helps track them down quicker. This is done as follows :
#ifndef _INCLUDEFILE_H
#define _INCLUDEFILE_H
#else
#error repeated include of this file
#endif
You can comment off the #else and the #error if you don't want that to be a fatal error.
In the past I have made the conversion to this style very quickly because it's easy to do and it has always resulted in significant improvements in compile time for me. In fact, generally speaking, the larger the project the larger the speed-up that I have seen.
Now, this is only a compile time improvement so it does not address your link time issue. There are lots of variables involved in link time. Efficiency of the linker, amount of available memory, and hard drive speed are three biggies. Unfortunately I don't have any easy answers for this.
|
|
|
|
|
Cool maneuver. Here I always thought that it's less efficient if you have one Include header.
Thanks!
|
|
|
|
|
Also...
You aren't doing full builds every time, are you?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
Yeah, I'm working in my Core at this time. It has alot of different helper forms, -casses and automation functions. I have to recompile the whole shabang, even if I only added a ShowMessage for debugging - The Builder Debugger crashes alot during step-trough variable inspection and i've lost tooo many code. (thanks to Builders bugs. )
|
|
|
|
|
Things to look into:
1. Precompiled headers.
2. Unneeded include files.
3. Using abstract base classes as interfaces to avoid having to include class definitions.
Steve
|
|
|
|
|
Stephen Hewitt wrote: 3. Using abstract base classes as interfaces to avoid having to include class definitions.
Yeah this is what i want to hear. I was never sure. Currently my design lacks abstraction. But now - implementing and converting candidate classes will mean a huge design change.
Thanks!
|
|
|
|
|
ok very simple: i am trying to read a line of text from a text file.
here is the text file:
dg_bead<br />
-15<br />
5<br />
5<br />
1<br />
0
here is the code that reads in the first line:
ifstream dg_scenario::dg_replay("replay.txt",ios::in);<br />
char tool_name[256];<br />
dg_replay.getline(tool_name,256);
i put a break point in this line:
dg_replay.getline(tool_name,256);
the app triggered the breakpoint and i stepped through it.
then i checked the value of tool_name and it was:
0x0222a978 ""
i checked all the indices of the array and they were all zero!
this is a very simple task - how should i resolve it.
P.S. i need to use the tool_name[256] char array as a char* to pass it as a parameter through a function that only accepts char*. is there a way i can convert the value stored in tool_name[256] (once the above prob is fixed) into a char* that stores the same value.
thx in advance.
--
dg
|
|
|
|
|
What happens if you try this?
ifstream dg_scenario::dg_replay("replay.txt",ios::in);
char tool_name[256];
if (dg_replay.is_open())
dg_replay.getline(tool_name,256);
or
ifstream dg_scenario::dg_replay("replay.txt",ios::in);
char tool_name[256];
if (dg_replay.good())
dg_replay.getline(tool_name,256);
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
nice to see you're helping kiddies cheat on their homework
|
|
|
|
|
I'm gullible like that!
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
genius - it works.
thanks!
--
dg
|
|
|
|
|
moonraker928 wrote: genius - it works.
I don't know why - I only added a line to check if the file was opened successfully
Glad it works!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
Is this a homework assignment? did the prof say you need to use tool_name limited to only 256 chars ... shame on you, I will not be a part of this!!!
|
|
|
|
|
|
hi all.
my app is throwing an unhandled exception - the problem appears to be caused when istream adds a null character at the end of a char array when the getline function is called
here is the code:
i initialized the tool_name in this line:
simpleTask.cpp
char* tool_name = "";
i put a breakpoint here:
simpleTask.cpp
dg_replay.getline(tool_name,256);
when i ran the app, the breakpoint was triggered. i stepped in and it brought me to this line:
istream.cpp
*_Str = _Elem(); // add terminating null character
at this time, an unhandled exception is thrown.
--
dg
|
|
|
|
|
I'm surprised it made it that far
char* tool_name = "";
defines and initializes a pointer to a constant array of characters 1 byte long (the NULL
terminator).
This should work better:
char tool_name[256] = "";
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
who names their file " simpleTask.cpp" and can't get it too work...LOL dude I told you already stop cheating on your homework assignment or I am going to tell!!!;P
|
|
|
|
|
hello friends
how can i read data from tablet connecting to my computer through usb interface
if one have a program doing this or any advise please send it ot me
i like to use visual c++ 6
|
|
|
|
|
1) Where can I obtain Microsoft Developer Network CD?
2) What are the other ways to know advanced windows concepts except for books written by Mark/David and Jeffry Richter
|
|
|
|
|
tom groezer wrote: 1) Where can I obtain Microsoft Developer Network CD?
From Microsoft.
tom groezer wrote: 2) What are the other ways to know advanced windows concepts except for books written by Mark/David and Jeffry Richter
Google for them. Read through CP articles. Ask questions.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
In terms of any other books
|
|
|
|
|
>>1) Where can I obtain Microsoft Developer Network CD?
I believe you would have to subscribe to MSDN for that? An alternative is to download the platform SDK, it comes with help files on the Win32 APIs that's pretty much all you need. You still have the MSDN website, much slower but you still get what you need.
>>2) What are the other ways to know advanced windows concepts except for books written by Mark/David and Jeffry Richter
Learning comes from reading and then applying, not sure if there are any short-cuts but if you find one let me know!
Books are your best best they will assemble all the bits and pieces for you, otherwise you will waste your time searching for on the net, plus you will get a fragmented view of things and be on here asking lots of questions
GL on your project!!!
|
|
|
|
|
See www.codeguru.com and www.codeproject.com about your section question.
|
|
|
|
|
- Is it possible to program using both
OpenGL api and Direct3D api, or is
this a big no-no?
- And, Yes I am crazy;P
"Shorter of breath,
and one day closer to death"
~Pink Floyd
|
|
|
|
|
Do you mean DirectX?
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|