Needed help with spliting up code
Moderator: Coders of Rage
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Needed help with spliting up code
Possibly because "extern blah" and "blah" are in the 'same file', since you #include "globals.h" in globals.cpp (this sort of pastes globals.h into globals.cpp). Ummm... try separating your externs out into a different .h or just writing the specific ones in the .cpps where they're needed? Not sure, extern's not something I've used since I was modding Q2.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Re: Needed help with spliting up code
I tried a little test to see if i have my globals somewere in my code
i didint include globals.h in any of my files, and i didint have multiple definition probloms
instead, i had the compiler complaining about the globals undeclared.
when i included globals.h back again, i have multiple definition problems.
i didint include globals.h in any of my files, and i didint have multiple definition probloms
instead, i had the compiler complaining about the globals undeclared.
when i included globals.h back again, i have multiple definition problems.
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: Needed help with spliting up code
oh, i didnt know that. sorry for giving out false information.MarauderIIC wrote:False. I've never seen it done this way and assume bad practice.PixelP wrote:you must do "extern" before every function in the header file.
Re: Needed help with spliting up code
problem solved.
i had to rebuild by priject because dev c++ was going crazy
im moving on to c::b
i had to rebuild by priject because dev c++ was going crazy
im moving on to c::b
Re: Needed help with spliting up code
I would recommend going for Microsoft Visual C++ Express actually, It's as free as the other two, but it is more powerful in 2 things - a great auto complete system (great for lazy coders ) and even better: a very good debugger (great for non-perfect people )Norbo wrote:problem solved.
i had to rebuild by priject because dev c++ was going crazy
im moving on to c::b
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Needed help with spliting up code
Con: Hard to distribute finished product. Nobody with a distribution problem has solved it yet. I think there's a thread in this forum about it.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Re: Needed help with spliting up code
Actualy no, you can redistribute easily with it, I do, and I helped the guy who was having trouble with it.MarauderIIC wrote:Con: Hard to distribute finished product. Nobody with a distribution problem has solved it yet. I think there's a thread in this forum about it.
(Basically it all comes down to changing a single project setting and adding 2 dlls of about 0.7mb each.. not such a big deal..)
No Con XD
-
- Respected Programmer
- Posts: 387
- Joined: Fri Dec 19, 2008 3:33 pm
- Location: Dallas
- Contact:
Re: Needed help with spliting up code
This has actually been a pretty big problem with VS9 in particular (VS2008 series). It's been a problem with all MS compilers, however; its a horrendous problem with 2008. If you ever run across code that you absolutely know should work or that a change was made then undone, especially where it pertains to multiple definition or NO definition: try a complete rebuild and 8 out of 10 it'll work.
The issue is that VS does not always correlate changes in source to changes across object files, so it does not recompile them though it may need to. Rebuilding destroys all the intermediates and object files, so the build time would be longer, but complete. It's always a good idea before a major build to rebuild the entire project under release and debug builds both with and without compiler code optimization before revisioning.
The issue is that VS does not always correlate changes in source to changes across object files, so it does not recompile them though it may need to. Rebuilding destroys all the intermediates and object files, so the build time would be longer, but complete. It's always a good idea before a major build to rebuild the entire project under release and debug builds both with and without compiler code optimization before revisioning.