Okay I'm an noob at this, but I think I got all this set up correctly, and I am being thown an:
[Admin@shadowrealm ircservices]$ g++ main.cpp -o services
In file included from main.cpp:1:0:
services.h:8:15: error: ISO C++ forbids declaration of âserivcesâ with no type [-fpermissive]
by the compiler (using g++)
main.cpp:
#include "services.h"
#include <iostream>
using namespace std;
int main(int ac, char **av)
{
services myservices;
if(myservices.startup() == 1)
cout << "Cool this works!!" << endl;
return(0);
}
services.h:
#ifndef SERVICES_H
#define SERVICES_H
class services
{
public:
serivces();
~services();
int startup();
};
#endif
services.cpp:
#include "services.h"
services::services()
{
}
services::~services()
{
}
int services::startup()
{
return 1;
}
this is puzzling to me, but as i said im not a pro at this, so watch it be some obvious error like "change 1 to 2" or something...
I'm replying to your second improvement.
You were probably missing one compilation step which is the creation of the object
file:
First step:
g++ -c services.cpp
This will create the object file that you can use for the last step which is called linking:
g++ main.cpp services.cpp -o executablename
Including the .cpp
files in the main solves the problem because you where literally pasting the entire code inside the main during pre-processing.
I suggest to read this http://homepages.gac.edu/~mc38/2001J/documentation/g++.html as an introduction to g++ compilation steps and this wikipedia page to get introduced to the ELF file format.