Error C2660 function doesn't take 1 agriment

Hi!
I started to build a simple game with C++ and the library SFML and I got an error:
error C2660: 'sf::Sprite::getTexture' : function does not take 1 arguments
and I got this error too: IntelliSense: too many arguments in function call



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
#include "stdafx.h"
#include "SplashScreen.h"

void SplashScreen::Show(sf::RenderWindow & renderWindow)
{
	
	sf::Texture texture;
	if(texture.loadFromFile("C:\Documents and Settings\Yonatan\My Documents\Downloads\SplashScreen.png") != true)
	{
		return;
	}
	
	sf::Sprite sprite;
	sprite.getTexture(texture);  //error C2660 - all the code in this line. error IntelliSense with the word 'texture' in this line.


	renderWindow.draw(sprite);
	renderWindow.display();

	sf::Event event;
	while(true)
	{
		while(renderWindow.pollEvent(event))
		{
			if(event.type == sf::Event::EventType::KeyPressed
				|| event.type == sf::Event::EventType::MouseButtonPressed
				|| event.type == sf::Event::EventType::Closed )
			{
				return;
			}
		}
	}
}


thx for help!
getTexture() returns the texture of a sprite. It doesn't have parameters, so passing any arguments to it will cause the error you got.

I think you mean to do this:
 
sprite.setTexture( texture );
Last edited on
YoniBE, what part of
getTexture() does not take 1 argument
don't you understand ???
it's dosen't work...
i got this error
Error 9 error LNK2019: unresolved external symbol "private: static void __cdecl Game::ShowSplashScreen(void)" (?ShowSplashScreen@Game@@CAXXZ) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ) C:\Documents and Settings\Yonatan\My Documents\Pang\Pang\Game.obj

and this
Error 11 error LNK1120: 2 unresolved externals C:\Documents and Settings\Yonatan\My Documents\Pang\Debug\Pang.exe

(I want upload an image)
Last edited on
Someone?
You haven't defined the function Game::ShowSplashScreen or you defined it in a source file that is not in your project. Correct that.
Topic archived. No new replies allowed.