Beginner problem - unable to compile Hello World example

Hi all,

I’m trying to compile the hello world example in VS2008.
I read through the tutorial (and added the libraries, etc.).
When I try to compile I get the following error:
Error 23 error LNK2001: unresolved external symbol _WinMain@16 MSVCRT.lib

I searched on the forums for something similar and couldn’t find such an issue.
How can I get past this?
Better yet: Where can I download a sample project in C++ (preferebly undre vs2008)?

Thanks in advance,
Ogga

First result on google:
social.msdn.microsoft.com/Forums … df596926a6

In other words, change your project to use the Console subsystem rather than the Windows subsystem. (Or create a WinMain function rather than a main function.)

Oh.
I was sure it should be a windows app.
Thanks.

btw - I have 22 warnings.

some of this nature:
Warning 8 warning C4996: ‘gmtime’: This function or variable may be unsafe. Consider using gmtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\panda3d-1.6.2\include\time_clock.h 195

and the rest of this nature:
Warning 22 warning C4275: non dll-interface class ‘std::_Container_base_aux’ used as base for dll-interface class ‘std::_Container_base_aux_alloc_real<_Alloc>’ C:\Program Files\Microsoft Visual Studio 9.0\VC\include\vector 439

Is this ok? (I’m guessing it is).

Thanks again,
Ogga

Yeah, you can ignore those warnings.

You can set your application to use the Windows subsystem, but that will make you unable to receive command-line output, and will require you to create a WinMain entry point instead of main.

Thanks for the answers.
That really cleared up my block and got me started.
Just one thing: How can I change the project to windows?
Just changing the subsystem and main to winmain still has the same error i got at the beginning.
Aside from command line arguments, btw, is there a reason to run in a console environment?

Er, you should probably keep it a console project. Otherwise you won’t have console output, and without it it becomes very hard to develop your application.

I suggest you put this code at the start of your main cpp file:

#ifdef CONSOLE
#pragma comment(linker, "/subsystem:console")
#else 
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif

That way you can always use a main() entry point rather than a WinMain(). It also allows you to switch subsystems by setting the define CONSOLE rather than changing the property pages.

And Panda will create a window for you regardless of the subsystem, but as rdb said, it’s convenient to have a console for development because you’ll be able to read Panda debugging messages, assertions, etc.

I’m getting the same errors, i’ve changed the linker to console nothing changed.

Actually, those aren’t the same errors at all. The OP had an error message about a missing function called WinMain. Your missing functions are all Panda functions; there is no mention of WinMain.

It looks like you haven’t added the Panda libraries to your project.

David


#include "pandaFramework.h"
#include "pandaSystem.h"

PandaFramework framework;
int main(int argc, char *argv[]) {

	framework.open_framework(argc, argv);
	framework.set_window_title("TestProject 1-1");
	WindowFramework *window = framework.open_window();

	//enable keyboard detection
	window->enable_keyboard();
	//enable default camera movement
	window->setup_trackball();

	if (window != (WindowFramework *)NULL) {

		nout << "Opened the window successfully!\n";

		// enter your code here

		framework.main_loop();
	}
	else
		{
		nout << "Could not load the window!\n";
		}

	//close the framework
	framework.close_framework();
	return (0);
}

Ok, thanks for the reply i’m still reletively new to this whole process, is there something i’m missing. I’ve added the librarys in the link input.

That does look like the right set of libraries, but something is still missing. What version of MSVS are you running? Also, what is the very first error message displayed?

David

I’m using C++ express 2008 and error 23 in the block above is the first error. The rest are just warnings.

If you are using 1.6.2 can you try again with a version of 1.7.0? You can get a “beta” here:

panda3d.org/buildbot/

I’m not suggesting this will solve your problem (it may) but it may be a better starting ground, I’ve always had more luck with 1.7.0 in C++, plus that way we are using the same and I can help you better.

Alright thanks alot :smiley: i’ll give it a try

#EDIT I downloaded and installed 1.7 unisntalled 1.6.2 and Even included the entire library from 1.7 getting the same problem.

I don’t know why would you need this, but it’s the only lib that you are missing that contains the symbol CycleData, so try adding this library:

libpalettizer.lib

If that doesn’t help, pack your whole project in a zip and upload it somewhere.

I added teh file no change still getting the same errors. Here is my complete project :smiley: thanks.

megaupload.com/?d=I33AGO0S

You forgot to do Step 3 in the manual…

Step three: Add libraries

After adding all these directories, right click on project and select properties. In the menu that comes up select the Linker and then the Input tab. In the Additional Dependencies row add the following libraries:

libp3framework.lib
libpanda.lib
libpandafx.lib
libpandaexpress.lib
libp3dtool.lib
libp3dtoolconfig.lib
libp3pystub.lib
libp3direct.lib

I did step three already.

There is no evidence of that in your project file.

Its something to do with GEOM its listed in every error maybe some file not listed in the manual that I need to add to included or something?