Error occurred: neljastest.cpp: mandatory reference vector 2 :: In reference to vector 2 (float, float)
/ P>
Neljastest.cpp:
#include & lt; Cstdlib & gt; # Include & lt; Iostream & gt; #include "../include/Vector2.h" #include "../include/neljas.h" using namespace std; Int main (int argc, char * argv []) {Vector 2 P1 (1.0, 2.0); Vector 2 p2 (0.0, 0.0); Vector 2 p3 (5.0, 2.0); Return EXIT_SUCCESS; } vector2.h:
#ifndef VECTOR2_H #define VECTOR2_H #include & lt; Iostream & gt; Using Std :: ostream; Square vector 2 {public: float x; Float Y; Vector2 (); Vector 2 (float nx, float ny); From float distance (vector 2v); }; Ostream & amp; Operator & lt; & Lt; (Ostream and valve, vector 2v); #endif vector2.cpp:
#include "../include/Vector2.h" # include & lt; Cmath & gt; using namespace std; Vector 2 :: Vector 2 () {x = 0; Y = 0; } Vector 2 :: Vector 2 (float nx, float ny) {x = nx; Y = NA; } Float Vector 2 :: Distance Frame (Vector 2V) {Return SCRT (X - VX) * (X - VX) + (Y - VA) * (Y - Vi)); } Ostream & amp; amp; Operator & lt; & Lt; (Ostream and OS, Vector 2 v) {Return to OS & lt; & Lt; "(" & Lt;
C / C ++ in the case of headers Case sensitive too It looks like you have to make changes with vector2.cpp and neljastest.cpp : P> #include "../include/Vector2.h" to:
#include "../include /vector2.h " I pasted all my sources in the same folder and successfully compiled them:
G ++ neljastest.cpp vector 2 CPP-O Negrestest Edit : Your problem is that the linking process of neljastest.cpp depends on src / vector2.cpp, and you are not doing this on the makefile
Comments
Post a Comment