Newbie question
#1
Posted 25 October 2009 - 09:50 AM
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#include <AL/al.h>
#include <AL/alut.h>
#define NUM_BUFFERS 1
#define NUM_SOURCES 1
#define NUM_ENVIRONMENTS 1
ALfloat listenerPos[]={0.0,0.0,4.0};
ALfloat listenerVel[]={0.0,0.0,0.0};
Alfloat listenerOri[]={0.0,0.0,1.0, 0.0,1.0,0.0};
ALfloat source0Pos[]={ -2.0, 0.0, 0.0};
ALfloat source0Vel[]={ 0.0, 0.0, 0.0};
Aluint buffer[NUM_BUFFERS];
Aluint source[NUM_SOURCES];
ALuint environment[NUM_ENVIRONMENTS];
ALsizei size,freq;
ALenum format;
ALvoid *data;
void init(void)
{
alListenerfv(AL_POSITION,listenerPos);
alListenerfv(AL_VELOCITY,listenerVel);
alListenerfv(AL_ORIENTATION,listenerOri);
alGetError(); // clear any error messages
// Generate buffers, or else no sound will happen!
alGenBuffers(NUM_BUFFERS, buffer);
if(alGetError() != AL_NO_ERROR)
{
printf("- Error creating buffers !!\n");
exit(1);
}
else
{
printf("init() - No errors yet.");
}
alutLoadWAVFile("a.wav",&format,&data,&size,&freq);
alBufferData(buffer[0],format,data,size,freq);
alutUnloadWAV(format,data,size,freq);
alGetError(); /* clear error */
alGenSources(NUM_SOURCES, source);
if(alGetError() != AL_NO_ERROR)
{
printf("- Error creating sources !!\n");
exit(2);
}
else
{
printf("init - no errors after alGenSources\n");
}
alSourcef(source[0], AL_PITCH, 1.0f);
alSourcef(source[0], AL_GAIN, 1.0f);
alSourcefv(source[0], AL_POSITION, source0Pos);
alSourcefv(source[0], AL_VELOCITY, source0Vel);
alSourcei(source[0], AL_BUFFER,buffer[0]);
alSourcei(source[0], AL_LOOPING, AL_TRUE);
}
1>------ Build started: Project: AL_testing, Configuration: Debug Win32 ------
1>Compiling...
1>AL_testing.cpp
1>c:\program files\microsoft visual studio 9.0\vc\include\al\alut.h(5) : fatal error C1083: Cannot open include file: 'alc.h': No such file or directory
1>Build log was saved at "file://c:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\AL_testing\AL_testing\Debug\BuildLog.htm"
1>AL_testing - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Omg, i'm using Microsoft C++ express to compile it. How come it can't detect the alc.h since it was already inside the AL folder. Any1 know how?
#2
Posted 25 October 2009 - 10:16 AM
2. Before "learning" OpenAL, learn your development environment of choice. The error points out that a file cannot be found and Visual Studio is pretty good at locating files, as long as you provide ALL necessary include paths to check.
3. Open alut.h, locate line 5, see how alc.h is included and what path should be added for this include to be located.
#3
Posted 25 October 2009 - 10:46 AM
1>------ Build started: Project: AL_testing, Configuration: Debug Win32 ------
1>Compiling...
1>AL_testing.cpp
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(14) : error C2146: syntax error : missing ';' before identifier 'listenerOri'
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(19) : error C2146: syntax error : missing ';' before identifier 'buffer'
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(20) : error C2146: syntax error : missing ';' before identifier 'source'
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(20) : error C2086: 'int Aluint' : redefinition
1> c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(19) : see declaration of 'Aluint'
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(31) : error C2664: 'alListenerfv' : cannot convert parameter 2 from 'int [6]' to 'const ALfloat *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(36) : error C2664: 'alGenBuffers' : cannot convert parameter 2 from 'int [1]' to 'ALuint *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(48) : error C2660: 'alutLoadWAVFile' : function does not take 5 arguments
1>c:\documents and settings\user\my documents\visual studio 2008\projects\al_testing\al_testing\al_testing.cpp(53) : error C2664: 'alGenSources' : cannot convert parameter 2 from 'int [1]' to 'ALuint *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://c:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\AL_testing\AL_testing\Debug\BuildLog.htm"
1>AL_testing - 14 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#4
Posted 25 October 2009 - 10:49 AM
#5
Posted 25 October 2009 - 11:01 AM
#6
Posted 25 October 2009 - 11:08 AM
#7
Posted 25 October 2009 - 12:08 PM
#8
Posted 25 October 2009 - 01:04 PM
1>------ Build started: Project: AL_testing, Configuration: Debug Win32 ------
1>Linking...
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alSourcefv referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alSourcef referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alutUnloadWAV referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alBufferData referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alutLoadWAVFile referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alGenBuffers referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alGetError referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alListenerfv referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\AL_testing\Debug\AL_testing.exe : fatal error LNK1120: 11 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\AL_testing\AL_testing\Debug\BuildLog.htm"
1>AL_testing - 12 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
what does this mean?
#9
Posted 25 October 2009 - 01:53 PM
#10
Posted 25 October 2009 - 01:58 PM
fatal error LNK1104: cannot open file 'C:\Program.obj'
lol...what is this mean again=.=.....
#11
Posted 25 October 2009 - 02:12 PM
#12
Posted 25 October 2009 - 02:30 PM
1>------ Build started: Project: AL_testing, Configuration: Debug Win32 ------
1>Linking...
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alutUnloadWAV referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>AL_testing.obj : error LNK2019: unresolved external symbol __imp__alutLoadWAVFile referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\AL_testing\Debug\AL_testing.exe : fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\AL_testing\AL_testing\Debug\BuildLog.htm"
1>AL_testing - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
it seems the error cannot be solved!!!..help=.=
#13
Posted 25 October 2009 - 02:34 PM
Link the ALUT library as well.
#14
Posted 25 October 2009 - 02:44 PM
'AL_testing.exe': Loaded 'C:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\AL_testing\Debug\AL_testing.exe', Symbols loaded.
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\OpenAL32.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\winmm.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\secur32.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\alut.dll', Binary was not built with debug information.
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcr90d.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\lpk.dll'
'AL_testing.exe': Loaded 'C:\WINDOWS\system32\usp10.dll'
The program '[5368] AL_testing.exe: Native' has exited with code 0 (0x0).
is it related to the regsvr32 prob?
#15
Posted 25 October 2009 - 02:46 PM
#16
Posted 25 October 2009 - 03:28 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












