Compile Errors VC++ 2005

I’m trying to compile the hello world example from the manual using VC++ 2005, but I keep receiving errors. I’m really not sure what to do to fix it- I checked over my includes and changed the compile mode to release, but the errors stayed the same. How do I get rid of these?

1>------ Build started: Project: MyProject, Configuration: Release Win32 ------
1>Compiling...
1>Main.cpp
1>c:\panda3d-1.5.3\include\threadDummyImpl.I(125) : error C2079: 'rqtp' uses undefined struct 'ThreadDummyImpl::sleep::timespec'
1>c:\panda3d-1.5.3\include\threadDummyImpl.I(126) : error C2228: left of '.tv_sec' must have class/struct/union
1>        type is 'int'
1>c:\panda3d-1.5.3\include\threadDummyImpl.I(127) : error C2228: left of '.tv_nsec' must have class/struct/union
1>        type is 'int'
1>c:\panda3d-1.5.3\include\threadDummyImpl.I(127) : error C2228: left of '.tv_sec' must have class/struct/union
1>        type is 'int'
1>c:\panda3d-1.5.3\include\threadDummyImpl.I(127) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\MyProject\MyProject\Release\BuildLog.htm"
1>MyProject - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It seems like the symbol WIN32 is not defined. Don’t know why not; I thought that one was defined automatically by MSVC. Well, try adding that symbol to your project, along with WIN32_VC.

David

It’s still not working…

#ifndef WIN32
#define WIN32
#ifndef WIN32_VC
#define WIN32_VC

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

PandaFramework framework;

int main(int argc, char *argv[]) {
    //open a new window framework
  framework.open_framework(argc, argv);
    //set the window title to My Panda3D Window
  framework.set_window_title("My Panda3D Window");
    //open the window
  WindowFramework *window = framework.open_window();

  //here is room for your own code

    //do the main loop, equal to run() in python
  framework.main_loop();
    //close the window framework
  framework.close_framework();
  return (0);
}

Here’s the new error:

1>c:\panda3d-1.5.4\include\threadDummyImpl.h(30) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

Maybe my includes are wrong?
Executable Files:
C:\Panda3D-1.5.4\bin
Include Files:
C:\Panda3D-1.5.4\include
C:\Panda3D-1.5.4\python\include
Library Files:
C:\Panda3D-1.5.4\lib
C:\Panda3D-1.5.4\python\libs
(I didn’t change any defaults in VC++)

First of all, you forgot the #endifs, secondly, it looks like you didn’t install the microsoft Platform SDK.
microsoft.com/express/2005/p … fault.aspx

Thanks, pro-rsoft- I missed that step…
I went all of the way through step 5, and was able to successfully build the Win32 Application.

Now the project compiles just fine, but I am getting linker errors when I build…

1>------ Build started: Project: MyProject, Configuration: Release Win32 ------
1>Linking...
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::close_framework(void)" (__imp_?close_framework@PandaFramework@@QAEXXZ) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::main_loop(void)" (__imp_?main_loop@PandaFramework@@QAEXXZ) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class WindowFramework * __thiscall PandaFramework::open_window(void)" (__imp_?open_window@PandaFramework@@QAEPAVWindowFramework@@XZ) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::set_window_title(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?set_window_title@PandaFramework@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::open_framework(int &,char * * &)" (__imp_?open_framework@PandaFramework@@QAEXAAHAAPAPAD@Z) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class BitMask<unsigned int,32> __cdecl BitMask<unsigned int,32>::lower_on(int)" (__imp_?lower_on@?$BitMask@I$0CA@@@SA?AV1@H@Z) referenced in function "void __cdecl `dynamic initializer for 'default_collision_node_collide_mask''(void)" (??__Edefault_collision_node_collide_mask@@YAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class BitMask<unsigned int,32> __cdecl BitMask<unsigned int,32>::bit(int)" (__imp_?bit@?$BitMask@I$0CA@@@SA?AV1@H@Z) referenced in function "void __cdecl `dynamic initializer for 'default_geom_node_collide_mask''(void)" (??__Edefault_geom_node_collide_mask@@YAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall PandaFramework::PandaFramework(void)" (__imp_??0PandaFramework@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'framework''(void)" (??__Eframework@@YAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall BitMask<unsigned int,32>::~BitMask<unsigned int,32>(void)" (__imp_??1?$BitMask@I$0CA@@@QAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'default_collision_node_collide_mask''(void)" (??__Fdefault_collision_node_collide_mask@@YAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall PandaFramework::~PandaFramework(void)" (__imp_??1PandaFramework@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'framework''(void)" (??__Fframework@@YAXXZ)
1>C:\Documents and Settings\Administrator\Desktop\MyProject\Release\MyProject.exe : fatal error LNK1120: 10 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\MyProject\MyProject\Release\BuildLog.htm"
1>MyProject - 11 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Looks like you didn’t add the Panda .lib’s to your project.

David

THANK YOU!! Finally I can use panda with c++! :astonished:

If anyone else is having the same problem, here is what I did to fix the above errors vc++ 2005:

Project -> Properties

Configuration Properties -> Linker -> Input -> Additional Dependencies

I then entered the following libraries into the box by referring to instructions on compiling with g++ in the manual:

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

David, everyone seems to be running into this issue. Can we add an internal check into Panda that defines WIN32 and WIN32_VC if _WIN32 is defined?
I believe all windows compilers have to define _WIN32 by default.

lists.boost.org/Archives/boost/2004/07/68241.php

That sounds like a good idea. That can be dropped into dtoolbase.h; that’s a file that every part of Panda includes.

David

Great! Added, and it will be in 1.6.0.