Ok.After brief reflection, I decided that the problem with
x64 was because i've tried to compile it like x86 Application (yes,my bad).
x86 was because i've changed Environment variable and didn't reboot my system, 
so when it tried to compile project, it used .dll files from x64 bin folder, 
that was set in path variable before.
As a result, I had the same errors in both cases.
btw switching between Multi-Byte Character Set / Unicode Character Set does not 
affect the work of application.
Anyway, I want to share my experience of the pre-compiled OSG setup for VS10. 
Hope it will be useful for someone.
Here is my step-by-step instructions for Dummies.
1. Download latest version of pre-compiled binaries from AlphaPixel 
(http://openscenegraph.alphapixel.com/osg/downloads/free-openscenegraph-binary-downloads).
 You will need at least two archives x86-debug&x86-release or/and 
x64-debug&x64-release
2. Unpack debug and release into one folder. (u will have 
bin,data,doc,include,lib,share folders). If u install x86 and x64, You can 
remove doc, data from one folder because it is the same files. (I've made root 
folder OSG,which contains data,doc,x64,x86 folders.And x86/x64 contains 
bin,lib,include folders.) You can also remove share folder, you dont need it 
for work.
3. Configure your Environment variables (choose one step only)
3.1 Do it yourself
3.1.1 Right click on the Computer icon and choose Properties option.
3.1.2 In the System window click on Advanced system settings in the left pane.
3.1.3 In the System Properties window select Advanced tab and click on 
Environment Variables… button.
3.1.4 In the Environment Variables window you will notice two columns User 
variables for a username and System variables. You should edit system vars.

Code:
OSG_ROOT - your OSG root folder
OSG_BIN_PATH = %OSG_ROOT%\bin 
OSG_INCLUDE_PATH = %OSG_ROOT%\include 
OSG_LIB_PATH = %OSG_ROOT%\lib 


not necessary:

Code:
OSG_SAMPLES_PATH = %OSG_ROOT%\share\OpenSceneGraph\bin 
OSG_FILE_PATH = %OSG_ROOT%\data
path = %path%;%OSG_BIN_PATH%;%OSG_SAMPLES_PATH%;


btw try to avoid spaces in your paths
3.2 Use batch file

Code:
@echo off
rem Tested on Win7x64, pre-compiled OSG 3.0.1 from AlphaPixel, VisualStudio2010
rem must work on Win7&Vista x86/x64
rem ©Kirill Serebriakov (17:06 14.01.2012)

set x86path=--!SET PATH TO YOUR X86 osg FOLDER!--
set x64path=--!SET PATH TO YOUR X64 osg FOLDER!--

rem data folder is not necessary
set data=--!SET PATH TO YOUR X64 data FOLDER!--
IF NOT EXIST %x86path% (echo x86path is not set or incorrect
GOTO x64)
:x86
SETX OSG_ROOTx86 %x86path% -m
SETX OSG_BIN_PATHx86 %%OSG_ROOTx86%%\bin -m 
SETX OSG_INCLUDE_PATHx86 %%OSG_ROOTx86%%\include -m
SETX OSG_LIB_PATHx86 %%OSG_ROOTx86%%\lib -m
:x64
IF NOT EXIST %x64path% (echo x64path is not set or incorrect 
GOTO finish)
SETX OSG_ROOTx64 %x64path% -m
SETX OSG_BIN_PATHx64 %%OSG_ROOTx64%%\bin -m
SETX OSG_INCLUDE_PATHx64 %%OSG_ROOTx64%%\include -m
SETX OSG_LIB_PATHx64 %%OSG_ROOTx64%%\lib -m
:finish
IF EXIST %data% (SETX OSG_FILE_PATH %data% -m)
echo reboot Your system
pause


and this one to delete paths

Code:
@echo off
:x86
echo Removing x86 OSG path
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_ROOTx86
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_BIN_PATHx86
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_INCLUDE_PATHx86
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_LIB_PATHx86
:x64
echo Removing x64 OSG path
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_ROOTx64
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_BIN_PATHx64
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_INCLUDE_PATHx64
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_LIB_PATHx64
:data
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 
/f /V OSG_FILE_PATH
:finish
echo reboot Your system
pause


3.3 Or you can skip this step, but you'll have to spend a little more time to 
configure Visual Studio
4. Don't forget to reboot your system if u change Environment variables.
5. Open Visual Studio. File -> New -> Project -> Visual C++ -> Empty Project 
6. Config your project. Project -> Properties
6.1. You must set path to your lib folder and include folder

Code:
C/C++ -> General -> Additional Include Directories add $(OSG_INCLUDE_PATH) 
Linker -> General -> Additional Library Directories add $(OSG_LIB_PATH) 


or

Code:
VC++ Directories -> Include Directories add $(OSG_INCLUDE_PATH) 
VC++ Directories -> Library Directories add $(OSG_LIB_PATH) 


if you skiped step 3, you must set absolute path to your folders.
6.2. Add Lib files

Code:
Linker -> Input -> Additional Dependencies add all .lib files that you need 
(for Debug LibNamed.lib)/without -d(for Release) 


6.3 Provide the application with required dll files
6.3.1 If u added OSG_BIN_PATH to your path variable u can skip this step (but u 
cant just copy app and run it on the other PC without required dll files).
6.3.2 Copy required dll files from OSG_BIN_PATH to your application folder by 
yourself.
6.3.3 Use Pre-Build Event like i did. Environment variable OSG_BIN_PATH must be 
set. Project -> Properties ->Build Events -> Pre-Build Events -> Command Line. 
Use quotes if you have spaces in your path ("$(OutDir)osg80-osgd.dl").

Code:
IF NOT EXIST $(OutDir)osg80-osgd.dll (mklink $(OutDir)osg80-osgd.dll 
$(OSG_BIN_PATHx86)\osg80-osgd.dll)
IF NOT EXIST $(OutDir)osg80-osgGAd.dll (mklink $(OutDir)osg80-osgGAd.dll 
$(OSG_BIN_PATHx86)\osg80-osgGAd.dll)
IF NOT EXIST $(OutDir)osg80-osgViewerd.dll (mklink 
$(OutDir)osg80-osgViewerd.dll $(OSG_BIN_PATHx86)\osg80-osgViewerd.dll)
IF NOT EXIST $(OutDir)osg80-osgAnimationd.dll (mklink 
$(OutDir)osg80-osgAnimationd.dll $(OSG_BIN_PATHx86)\osg80-osgAnimationd.dll)


7. Make some code.
P.S. Problem Solved

Thank you!

Cheers,
Kirill

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44842#44842





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to