过去几周我一直在玩一个小游戏,一切都很好,但今天我得到了一个错误,我似乎无法找到导致它的原因。确切的错误是:
-lnk1120 1未解析的外部
-lnk2001未解析的外部符号" public:_cdecl projectile :: projectile(void)" (?? 0projectile @@ @ QEAA XZ)
在其他几篇文章中,我读到可能是因为我没有为我的库(sfml)链接正确的文件,但我还没有在其他.h中收到这些错误。 .cpp文件在我的项目期间和检查我的链接器10次后,我仍然无法找到我做错了什么。我甚至清空了我的cpp文件中的函数,但无济于事。这些是我的文件:
projectile.h:
#pragma once
#include "collision.h"
#include "Player.h"
#include "platformsManager.h"
#include "SFML\Graphics.hpp"
#include "SFML\System.hpp"
class projectile {
public:
projectile();
void updateMoveFactors();
void updateMovement();
void getCollision(sf::FloatRect collisionrect);
void schootProjectile(
float xShot,
float yShot, //yOfShot
float startShootAngle, //angle of shot
float startSpeed, //speed of shot
sf::FloatRect StartLocalHitboxRect, //local hitboxrect
sf::Texture * startProjectileTexture,
int newUpdateTime = 10,
float startVerticalAccel = 2, //how fast it falls
float startHorizontalAccel = -1 //how fast it deaccelerates
);
void drawProjectile(sf::RenderWindow * window);
private:
sf::Vector2f speed;
sf::Vector2f acceleration;
sf::Vector2f projectileCoords;
float shootAngle;
sf::Texture * projectileTexture;
sf::Sprite projectileSprite;
int updateTime;
int timesUpdated;
int landTime;
bool status;
bool inAir;
timer projectileTimer;
//temp:
sf::Texture arrowTexture;
};
projectile.cpp: `
#pragma once
#include <math.h>
#define PI 3.14159265359
#include "projectile.h"
projectile::projectile() {
}
void projectile::updateMoveFactors()
{
}
void projectile::updateMovement()
{
}
void projectile::getCollision(sf::FloatRect collisionrect)
{
}
void projectile::schootProjectile(float xShot, float yShot, float startShootAngle, float startSpeed, sf::FloatRect StartLocalHitboxRect, sf::Texture * startProjectileTexture, int newUpdateTime, float startVerticalAccel, float startHorizontalAccel)
{
}
void projectile::drawProjectile(sf::RenderWindow * window)
{
}`
很抱歉,如果我没有提供足够的信息,或者这是一个愚蠢的问题,我还是一个相当新的编程方式。 任何帮助/反馈表示赞赏:)。 提前致谢