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)/with