Unresolved External Symbol
Vectors CPP:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
// Vectors.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "Vector2.h"
Vector2::Vector2() : x_(0), y_(0)
{ }
Vector2::Vector2(float x, float y)
: x_(x), y_(y)
{ }
Vector2::~Vector2()
{ }
float Vector2::GetX() const
{
return x_;
}
float Vector2::GetY() const
{
return y_;
}
void Vector2::SetX(const float x)
{
x_ = x;
}
void Vector2::SetY(const float y)
{
y_ = y;
}
|
main.cpp:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include "stdafx.h"
#include <iostream>
#include "Vector2.h"
using namespace std;
int main()
{
Vector2 vec;
cout << vec.GetX() << endl;
cout << vec.GetY() << endl;
cin.get();
return 0;
}
|
Vectors Header File:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#ifndef VECTOR2_H
#define VECTOR2_H
#include <iostream>
class Vector2
{
private:
float x_;
float y_;
public:
Vector2();
Vector2(float x, float y);
~Vector2();
float GetX() const;
float GetY() const;
void SetX(const float x);
void SetY(const float y);
};
#endif
|
I basically keep getting the errors:
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
error LNK1120: 1 unresolved externals
How can I eradicate these errors? Thanks.
Last edited on
You need to start a new empty project, not a Win32 or Console project or any of the other ones that have pre-made code that you edit.
You can start the new blank project and then copy in your existing code - just make sure to remove #include "stdafx.h"
Topic archived. No new replies allowed.