I'm using Fmod in a project I'm working on in Visual C++ 2008. If I include
../fmodapi375win/api/lib/fmodvc.lib
in Project->Linker->Input, it works fine, but for some reason if I use
#pragma comment(lib,"../fmodapi375win/api/lib/fmodvc.lib")
instead it works the same as if that line wasn't there: it builds with no linker errors then crashes with a stack overflow from a million access violation exceptions.
What's going on, and how can I fix it so I can define the lib in code?
#pragma comment( lib, "emapi" ) The following pragma causes the compiler to place the name and version number of the compiler in the object file: C Copy.
#pragma comment is a compiler directive which indicates Visual C++ to leave a comment in the generated object file. The comment can then be read by the linker when it processes object files.
I don't think you are supposed to provide the .lib in the pragma comment, but, I think the real problem is that you are calling the comment by path. Add the path to your lib search paths, and then just use a
#pragma comment(lib,"fmodvc")
You are SUPPOSED to be able to use a path in this comment, but are you sure the ..\ path you are using is the correct path during link time? Also make sure you are NOT compiling with the /nodefaultlib...
Let me know if this still does not work. I've used this type of pragma a lot, with great success...
But, now that I'm pretty much trapped in the C# world, I don't get much time to even program in C++ anymore...
Libs could be linked in another order, so symbols are resolved differently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With