Following a C++ tutorial, the user (using CodeBlocks) has me to add a class through the File Menu: File -> New -> Class
So now I have main.cpp, bottles.cpp and bottles.h. But, unlike his that works, mine throws an error when I try to run it:
-------------- Build: Debug in tut-002 (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -std=c++11 -I -c /home/slyde/Desktop/CB/Tutorials/tut-002/bottles.cpp -o obj/Debug/bottles.o
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
main.cpp has a main in it.
#include <iostream>
#include "bottles.h"
//using namespace std;
int main()
{
bottles bo;
return 0;
}
bottles.cpp:
#include "bottles.h"
#include <iostream>
bottles::bottles()
{
std::cout << "Am I a glass bottle? Or am I made of plastic?" << std::endl;
}
bottles.h:
#ifndef BOTTLES_H
#define BOTTLES_H
class bottles
{
public:
bottles();
//protected:
//private:
};
#endif // BOTTLES_H
And the guy in the video...he never references any necessary setting(s) to run this. Will someone tell me what do I have to do to "fix" this? T tried adding a linker option: $(LINK) -nostartfiles -g ... that I got from here (https://stackoverflow.com/questions/11116399/crt1-o-in-function-start-undefined-reference-to-main-in-linux). But that didn't work.
Thanks.