🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

VC++ Build Problem

Started by
7 comments, last by Qoy 24 years, 5 months ago
In VC++, when you build the project (not with rebuild all) it''s supposed to only rebuild the files that have changed, and it usually does. But just recently I implemented a template class for a linked list, and all the functions are inline in the class in the header file. Now, when I edit the functions in the header, and try to build all, it doesn''t build anything! It''s getting kind of annoying, having to rebuild the project every time I modify a function in the header. Does anybody know any reasons for this? ------------------------------ Jonathan Little invader@hushmail.com http://www.crosswinds.net/~uselessknowledge
Advertisement
Have you tried ''update dependencies''?

DaBit.
I have the same problem.
WATCOM (that i used before) always re-compiled the C++ files that included the modified H. Is it possible to make Visual C++ do the same?
Are you talking about real templates?

If so that might cause the problem, seeing that they basically manufacture new source code to be compiled every time you instatiate with a new type.
-the logistical one-http://members.bellatlantic.net/~olsongt
You might try turning off "Incremental Linking."

Other than that, I can''t think of anything.

Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!
www.spin-studios.com
Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
My solution to your problem is to put the functions for the class into a cpp file. In order to do this, at the bottom of your .h file include the .cpp file. Here is an example of what I mean:

The .h file

#ifndef __SOME_H_FILE_#define __SOME_H_FILE_//your class definition#include "some.cpp";#endif 


the .cpp file

#ifndef __SOME_CPP_FILE_#define __SOME_CPP_FILE_#include "some.h";//functions for the class#endif 


The above is necisary to avoid double decleration compile erros.
I know to put the functions in a cpp file, but that wasn''t working, and in the gamedev chat room someone suggested that I put the functions all inline in the class (in the header file). Then it worked. That''s why I put the functions int the h file. I know the templates make new code for every class I use them with, that was the point of using them. The functions are declared inline with the class, so just putting them at the bottom of the h file isn''t going to work. I already tried that... And turning off incremental linking doesn''t work. I don''t know what could be causing this, as VC usually recompiles any files that depend on the headers.
I will try that including of the cpp file thing again, though...
Is the header file listed under the Header Files folder thing in the file list or is it under Externel Dependencies? If it''s under External Dependencies it won''t count towards recompiling when it changes. This kind of thing can happen when loading projects from another source into Visual C++.
Just a stab in the dark.
Nope. It''s listed under header files. And putting the functions in a cpp file didn''t work... I don''t know, it must just be an "undocumented feature" of the IDE.
Anyone have any other ideas?

This topic is closed to new replies.

Advertisement