I have sliced a moyenne.cpp
program that makes the average of a c ++ rating vector in three: main.cpp
, moyenne.cpp
and moyenne.h
.
The file only works, but today the program tells me when it did g++ main.cpp -o main
that:
In function 'main':
main.cpp:(.text+0x196): undefined reference to 'moyenne(std::vector<double, std::allocator<double> > const&)'
However, it is used in main.cpp
#ifndef MOYENNE_H_INCLUDED
#define MOYENNE_H_INCLUDED
#include<vector>
double moyenne(std::vector<double>const& tableau);
and the same "includes" in moyenne.cpp.
update
When I did g++ moyenne.cpp -o moyenne
I have a similar error:
$ g++ moyenne.cpp -o moyenne
/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
Then I do not understand where this undefined reference is ...