#### Archived

This topic is now archived and is closed to further replies.

# gotoxy or something in VC++

This topic is 6187 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

gotoxy is function in Borland C++. It changes cursor position in dos promt. I want to do the same thing in Visual C++. The only function what I found was SetConsoleCursorPosition. Well, it seems ok but it doesn''t work! I have included its header windows.h and I have added its library kernel32.lib but when I try to link my little program it says: Console.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) int __stdcall SetConsoleCursorPosition(void *,struct _COORD)" (__imp_?SetConsoleCursorPosition@@YGHPAXU_COORD@@@Z) Have anybody succesfully used SetConsoleCursorPosition? I have win98SE and Visual Studio 6.0 with newiest Service Packs. Is there some another way?? Please help me!

##### Share on other sites
Maybe you need another dllfile or lib file
Dont know exactly what file
But where do you need it for?

##### Share on other sites
That error message looks to me like it''s looking for a .DLL. Are you linking with the right DLL files? I could be horribly wrong, though.

##### Share on other sites
SetConsoleCursorPosition

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Import Library: Use kernel32.lib.

That is from MSDN.
I have declared wincon.h and I have added kernel32.lib to right place. It should work..

##### Share on other sites
This took less than 2 minutes;

1. Make a new project; an empty Win32 console application.
2. Create a new C++ source file, and paste this code into it:

  #include #include void main(void){ COORD pos; pos.X = 20; pos.Y = 10; SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), pos); cout << "This works fine!" << endl;}

I''d check you are actually working with a console project and not a lib,dll or Win32 app.

- Matt

##### Share on other sites
I tried that and it''s almost the same what I have already tried..
Sorry but it doesn''t work with my computer.. Now I''m sure that there is something wrong with this machine..

I''l try install Visual Studio again..

##### Share on other sites
by putting the lib in the right place do you mean you added it specifically to this project or just that it is in your include place? You probably have this right but other people will read this thread and this really bothered me as a newbie. Go to project-settings-link-object/library modules and add whatever libraries you need there.

##### Share on other sites
Yes. kernel32.lib is in there Object/Library modules and it''s also in project options.
Well.. I have Borland C++ now and I tried gotoxy with that (same thing as SetConsoleCursorPosition).. It works great, and I''m thinking to change Borland C++.. I have used Borland Delphi and Turbo Pascal so I think this is much easier to me than Visual C++.. I''m still doing all DirectX stuff with Visual C++..
Thanks everybody who helped me!

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
17
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002297
×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!