Page 2 of 2

Re: Needed help with spliting up code

Posted: Tue Mar 24, 2009 9:29 pm
by MarauderIIC
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.

Re: Needed help with spliting up code

Posted: Wed Mar 25, 2009 1:45 am
by Norbo
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.

Re: Needed help with spliting up code

Posted: Wed Mar 25, 2009 2:23 am
by PixelP
MarauderIIC wrote:
PixelP wrote:you must do "extern" before every function in the header file.
False. I've never seen it done this way and assume bad practice.
oh, i didnt know that. sorry for giving out false information.

Re: Needed help with spliting up code

Posted: Thu Mar 26, 2009 2:15 am
by Norbo
problem solved.
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

Posted: Thu Mar 26, 2009 3:36 am
by kostiak2
Norbo wrote:problem solved.
i had to rebuild by priject because dev c++ was going crazy
im moving on to c::b
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 ;) )

Re: Needed help with spliting up code

Posted: Thu Mar 26, 2009 8:23 am
by MarauderIIC
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.

Re: Needed help with spliting up code

Posted: Thu Mar 26, 2009 9:59 am
by kostiak2
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.
Actualy no, you can redistribute easily with it, I do, and I helped the guy who was having trouble with 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

Re: Needed help with spliting up code

Posted: Thu Mar 26, 2009 11:22 am
by qpHalcy0n
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.