Hi everyone, I am a newbie at programming and tired of trying to compile on visual studio i looked for an alternative a couple of days ago and code::blocks seems to be a good one, the thing is, the program runs brilliantly with small functions, but when i try to build a simple class, it gives me back the following error message:
-------------- Build: Debug in spain (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -I -c C:\Users\miguelangel\Desktop\train2game\spain\hola.cpp -o obj\Debug\hola.o
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))
now my three files are:
main.cpp:
#include <iostream>
#include "hola.h"
using namespace std;
int main()
{
hola ho;
cout << "hello world" << endl << endl;
return 0;
}
-------------------------
hola.h:
#ifndef HOLA_H
#define HOLA_H
class hola
{
public:
hola();
protected:
private:
};
the project is set to be a console application, not a windows one, could anyone help me out with this please? i would really appreciate it as i feel like not trying to advance any deeper until i now what is happening here... thank you so much in advance
hi MiiNiPaa, thank you but i have just checked one by one and i got all three files with a check on compile file, to me is just not making any sense anymore... is really putting me off and is propably something really easy...
noted, that is now unchecked and i added them both to a new console application project, still keeps giving me the exact same message:
-------------- Build: Debug in testing (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -I -c C:\Users\miguelangel\Desktop\train2game\testing\hola2.cpp -o obj\Debug\hola2.o
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))
Hi there bud, sorry but i just finished work i could not reply before, well the thing now is this, when i arrived before i tried to send you the copy of my project, I decided to delete the whole thing and start again, but this time instead to doing it on the GNU GCC compiler i chose visual studio 2010 and did exactly the same and it worked, it even gave me back a value for a destructor!! why do you think was happening that now bearing in mind that it was probably due to the type of compiler?
I really appreciate your help mate, thanks very much :)