News Add-On Development for O.2009

EtherDragon

Addon Developer
Addon Developer
Joined
Mar 20, 2008
Messages
106
Reaction score
0
Points
0
Location
Ellensburg
So, I took about 30 minutes last night and looked at the SDK samples for Orbiter-2009 RC1 using Microsoft Visual C++ 2008 Express. Here's what I found...

All of the projects need to be run through VC2008's conversion process, which is no big deal.

I tried to complile the following samples:
ShuttlePB: No errors, compiled and ran perfectly in Orbiter 2009RC1
CustomMFD: No Errors, compiled and ran perfectly in O.2009.RC1
DeltaGlider: Build Errors: Could not find afxres.h, of any of the Lua includes.
- missing afxres.h can be solved by getting the Microsoft Platform SDK for Server 2008 and .net 3.5 (They were downloading last night, will try again tonight) and copying the header into the project.
- missing Lua headers can be solved by adding the Lua directory to additional include directories in the project settings.

Once O.2009 is final, I'll put together a VC++2008Express freindly project for DeltaGlider on OH, if needed.

Summary - our Add-on Development life is about to get considerably easier...
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Thanks for the report. Can you check the following:

* does the project compile and run properly even without afxres.h if you replace the "afxres.h" references (two each in DeltaGlider.rc and DGConfigurator.rc" with "winres.h"?

* does it compile ok even without adding the lua include directories if you replace

Code:
extern "C" {
#include <lua\lua.h>
#include <lua\lualib.h>
#include <lua\lauxlib.h>
}
with

Code:
extern "C" {
#include "lua\lua.h"
#include "lua\lualib.h"
#include "lua\lauxlib.h"
}
in DGLua.cpp? If not, can you check if the $(SDKInlcudeDir) project macro points to the correct directory?
 

eveningsky339

Resident Orbiter Slave
Addon Developer
Donator
Joined
May 3, 2008
Messages
1,062
Reaction score
1
Points
0
Location
Western Maine
Perhaps this is a trivial question, but what difference is there between enclosing the #include h's in ""'s and <>'s?
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
<> header files are searched in system include directories, "" header files in project-specific directories (compile directory and explicitly defined include directories). But some compilers seem to be more thorough than others in where they look if they don't find the required includes, so they may look in both system and project folders for all includes, and just use the <> and "" quotes to select the search order.
 

Bj

Addon Developer
Addon Developer
Donator
Joined
Oct 16, 2007
Messages
1,886
Reaction score
11
Points
0
Location
USA-WA
Website
www.orbiter-forum.com
Perhaps this is a trivial question, but what difference is there between enclosing the #include h's in ""'s and <>'s?

here
Quoted form -
This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.

Angle-bracket form -
This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.​
Edit: formatting got all screwed up --and martin already posted
 
Last edited:

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Syntax Form Action Quoted form This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable. Angle-bracket form This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.
In this case I don't really understand why VS2008 doesn't find the lua includes, since the Orbitersdk/include directory is specified with the /I option. Unless the SDK directory macro is not correctly defined, but then none of the include files should be found. VS2005 (at least in my installation) doesn't seem to have problems.
 

EtherDragon

Addon Developer
Addon Developer
Joined
Mar 20, 2008
Messages
106
Reaction score
0
Points
0
Location
Ellensburg
I spent some more time tinkering with the O.2009 SDK Delta Glider...
Here's what I did so far,
I copied afxres.h into the project folder - eliminated missing afxres.h error
I copied winres.h into the project folder - eliminated missing winres.h error

Now I'm stuck trying to resolve conflicting symbals and such revolving around LIBC.LIB

Currently the project is set to /MD (Multi-threaded DLL) and I get a bunch of build errors:
1>Linking...
1>LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __CRT_INIT@12 already defined in MSVCRT.lib(crtdll.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __DllMainCRTStartup@12 already defined in MSVCRT.lib(crtdll.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBC.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBC.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBC.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBC.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)
1> Creating library Release\DeltaGlider.lib and object Release\DeltaGlider.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBC' conflicts with use of other libs; use /NODEFAULTLIB:library

When I try /MT I get these errors:
1>Linking...
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::eek:perator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __cinit already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __cexit already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __C_Exit_Done already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __C_Termination_Done already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __exitflag already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __wpgmptr already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __pgmptr already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: ___winitenv already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __wenviron already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: ___initenv already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __environ already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: ___wargv already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: ___argv already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: ___argc already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(crt0dat.obj) : error LNK2005: __umaskval already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __CRT_INIT@12 already defined in LIBCMT.lib(dllcrt0.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __DllMainCRTStartup@12 already defined in LIBCMT.lib(dllcrt0.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __amsg_exit already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: ___app_type already defined in LIBCMT.lib(dllcrt0.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: ___error_mode already defined in LIBCMT.lib(dllcrt0.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __aexit_rtn already defined in LIBCMT.lib(crt0dat.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __wenvptr already defined in LIBCMT.lib(dllcrt0.obj)
1>LIBC.lib(dllcrt0.obj) : error LNK2005: __aenvptr already defined in LIBCMT.lib(dllcrt0.obj)
1> Creating library Release\DeltaGlider.lib and object Release\DeltaGlider.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBC' conflicts with use of other libs; use /NODEFAULTLIB:library

I think the only reason the DeltaGlider even wants LIBC.LIB is because Lua was built using it.

I won't get another chance to look at this until next week sometime. =(


---------- Post added at 07:55 PM ---------- Previous post was at 07:34 PM ----------

Thanks for the report. Can you check the following:

* does the project compile and run properly even without afxres.h if you replace the "afxres.h" references (two each in DeltaGlider.rc and DGConfigurator.rc" with "winres.h"?

* does it compile ok even without adding the lua include directories if you replace

Code:
extern "C" {
#include <lua\lua.h>
#include <lua\lualib.h>
#include <lua\lauxlib.h>
}
with

Code:
extern "C" {
#include "lua\lua.h"
#include "lua\lualib.h"
#include "lua\lauxlib.h"
}
in DGLua.cpp? If not, can you check if the $(SDKInlcudeDir) project macro points to the correct directory?

I couldn't find $(SDKIncludeDir) in any of the properties...

It didn't compile with the suggested changes. The compiler reports that it can't find lua/lua.h, lualib.h, nor lauxlib.h

It also reports that it can't find winres.h - but I think that's PEBCAK on my part (still trying to tinker w/it)
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
SDKIncludeDir is defined in orbiter_vs2005.vsprops, which is inherited by Orbiter vessel.vsprops, which in turn is inherited by both the Deltaglider release and debug property sheets. If you don't get it in your project, something seems to have gone wrong with the inherited property sheets.

The lua header files are located in $(OrbiterDir)/Orbitersdk/include/lua, so as long as the $(SDKIncludeDir) points to $(OrbiterDir)/Orbitersdk/include, the compiler should be able to find them.
 

EtherDragon

Addon Developer
Addon Developer
Joined
Mar 20, 2008
Messages
106
Reaction score
0
Points
0
Location
Ellensburg
Yea, maybe something in the automatic conversion process from 2005 to 2008express missed. I'll try again in a few days.

---------- Post added 10-29-2009 at 05:10 PM ---------- Previous post was 10-28-2009 at 08:47 PM ----------

I looked around after work a bit, and can't find LUA files anywhere in the SDK include folder... Here's a screenie of what I do see, as of RC1-091923

 

lockingtoggle

Donator
Donator
Joined
Sep 16, 2008
Messages
96
Reaction score
0
Points
0
I'v got it compile OK in VC2008 and 2005

Had to:

1. Copy the "\Orbitersdk\samples\LuaScript\Lua\include" files to "\Orbitersdk\include\Lua"
2. Change DGLua.cpp <lua\*.h> to "lua\*.h"
3. Copy lua5.1.lib from "\Orbitersdk\samples\LuaScript\Lua\dll" to "\Orbitersdk\lib"
4. copy "libc.lib" from some obscure system folder to "\Orbitersdk\lib"

The only error I get is "Warning 1 warning C4060: switch statement contains no 'case' or 'default' labels \Orbitersdk\samples\DeltaGlider\DeltaGlider.cpp 3345 DeltaGlider
"

But, where is the blody DeltaGlider.dll ? In the /release folder I only get a "DeltaGlider.dll.intermediate.manifest" file! What am I doing wrong?
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
I'v got it compile OK in VC2008 and 2005

Had to:

1. Copy the "\Orbitersdk\samples\LuaScript\Lua\include" files to "\Orbitersdk\include\Lua"
2. Change DGLua.cpp <lua\*.h> to "lua\*.h"
3. Copy lua5.1.lib from "\Orbitersdk\samples\LuaScript\Lua\dll" to "\Orbitersdk\lib"
4. copy "libc.lib" from some obscure system folder to "\Orbitersdk\lib"

The only error I get is "Warning 1 warning C4060: switch statement contains no 'case' or 'default' labels \Orbitersdk\samples\DeltaGlider\DeltaGlider.cpp 3345 DeltaGlider
"

But, where is the blody DeltaGlider.dll ? In the /release folder I only get a "DeltaGlider.dll.intermediate.manifest" file! What am I doing wrong?
I believe the stock SDK samples have the final destination of the file as their output directory; ie, "<orbiterdir>\Modules" would be the location of the dll.
 
Last edited:

EtherDragon

Addon Developer
Addon Developer
Joined
Mar 20, 2008
Messages
106
Reaction score
0
Points
0
Location
Ellensburg
I'v got it compile OK in VC2008 and 2005

Had to:

1. Copy the "\Orbitersdk\samples\LuaScript\Lua\include" files to "\Orbitersdk\include\Lua"
2. Change DGLua.cpp <lua\*.h> to "lua\*.h"
3. Copy lua5.1.lib from "\Orbitersdk\samples\LuaScript\Lua\dll" to "\Orbitersdk\lib"
4. copy "libc.lib" from some obscure system folder to "\Orbitersdk\lib"

The only error I get is "Warning 1 warning C4060: switch statement contains no 'case' or 'default' labels \Orbitersdk\samples\DeltaGlider\DeltaGlider.cpp 3345 DeltaGlider
"

But, where is the blody DeltaGlider.dll ? In the /release folder I only get a "DeltaGlider.dll.intermediate.manifest" file! What am I doing wrong?


What did you do about missing afxres.h?

---------- Post added at 08:27 PM ---------- Previous post was at 07:40 PM ----------

Ok, I got it to compile!

I had to get the latest Microsoft Platform SDK, but the only option I had to select was the Win32 Samples (about 39mb).

After following Lockingtoggle's instructions:

I found a copy of afxres.h and winres.h and copied them into each project folder with the other source code.

It compiled and ran fine - I used the Demo flight to the Moon to test. Works great!

~ED
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,883
Reaction score
2,135
Points
203
Location
between the planets
All of the projects need to be run through VC2008's conversion process, which is no big deal.

It is when you're still using W2k... :shifty:

Oh well... planned to update to Windows 7 when it comes out anyways...
 
Top