Sorry, but it doesn't sound like you've been programming "properly" if a thing like this causes you problems :)


I don't like your judging my programming abilities. I am not C programmer and that's why I am asking for help in here. I have never had code in one module only. Neither in Delphi, nor in Assembly and other programming languages that I actually use. I am not even going to read your judgmental posts. You have to reconsider your way of talking to people. I don't understand how you can start judging my coding style in general just by looking at a question that I have about a programming language that I neither like, nor have any experience in.
Posted on 2007-12-27 17:08:56 by XCHG
Take it easy, XCHG.

Obviously you don't have a lot of C/C++ experience, that's nothing to be ashamed of, and I'm not trying to make a fool of you - just clarifying some facts, so we can establish where you stand and what kind of help you need.

Delphi (which is really Object Pascal) isn't that different from C/C++, and in that language you still need declaration vs. definition when using multiple modules. It's a bit easier to handle, though, since you don't need to deal with the physical separation of .h and .cpp files, you just do "using module". You can consider the INTERFACE block the .h file and the IMPLEMENTATION block the .cpp file.

It's a pretty neat approach and I wish C/C++ had the notion of "units" or "packages" instead of only .h/.cpp/.obj/.lib files, it's easier to use/distribute and faster than having to re-parse header files all the time (yeah yeah, #pragma once, internal optimizations and precompiled headers all help.)

Anyway, I digress. What you're having is compiler errors as opposed to linker errors, so your problem lies with the layout of the .h and .cpp files. What is it that confuses you?
Posted on 2007-12-27 18:28:12 by f0dder
Just to clarify: I didn't mean to be patronizing. I don't see my answers as arrogant, but just a bit tongue-in-cheek. If I offended you, please accept my apologies.
Posted on 2007-12-27 18:55:01 by f0dder