User forums > General (but related to Code::Blocks)
How to compile .h with a .cpp file
(1/1)
pisco:
Hey guys
here is my prob. I have two file. One is a .h and the other is a .cpp file:
--- Quote ---// Grundstueck.cpp (bspl0048.cpp)
#include <iostream>
#include <cstring>
#include "bspl0048a.h" // Grundstueck.h
using namespace std;
Grundstueck::Grundstueck() {
}
Grundstueck::~Grundstueck() {
}
void Grundstueck::speichereGrunddaten(const char *n,
int f, int st, int g) {
strncpy(gemarkung, n, 29);
flur=f;
flurstueck=st;
groesse=g;
sachwert=static_cast<float>(g)*180;
}
void Grundstueck::zeigeGrunddaten() const {
cout << "\n" << "Gemarkung: " << gemarkung << "\n"
<< "Flur: " << flur << "\n"
<< "Flurstueck: " << flurstueck << "\n"
<< "Groesse: " << groesse << "\n"
<< "Wert: " << sachwert;
}
--- End quote ---
and
--- Quote ---// Grundstueck.h (bspl0048.h)
#ifndef _GRUNDSTUECK_
#define _GRUNDSTUECK_
class Grundstueck {
public:
Grundstueck();
~Grundstueck();
void speichereGrunddaten(const char *n,
int f, int st, int g);
void zeigeGrunddaten() const;
private:
char gemarkung[30];
int flur, flurstueck, groesse;
protected:
float sachwert;
};
#endif
--- End quote ---
I am a total newbie in code::blocks so here is my question:
How can I compile those two file to one .exe file?
I thank you in advance for your time and attention and look forward to your replys.
greetz pisco
MortenMacFly:
--- Quote from: pisco on January 13, 2010, 03:55:58 pm ---How can I compile those two file to one .exe file?
--- End quote ---
Setup a project, add both files to the project hit compile and you are done. Consult the C::B documentation (http://www.codeblocks.org/docs/main_codeblocks_en.html) accordingly.
pisco:
thx thx thx for your reply MortenMacFly
could you please explain me the exact steps ,because I have not enough time to read the documentation... :(
greetz pisco
Navigation
[0] Message Index
Go to full version