unable to link FMOD library to VS2010 project - c++

I am trying to link FMOD to my project, which I did very easily in the past in Visual Studio 2008.... So I have placed the fmodex_vc.lib and the fmodex.dll file in my project directory, added them to my project's solution explorer, then created a SoundMgr.h file which includes the fmod.h file
#include "include\fmod\fmod.h"
Where fmod has been placed in the include\fmod folder and opens ok if i right click on the above code and click "Open Document"...
But if I try to write any code at all, including a simple "using namespace FMOD" it tells me that it FMOD is undeclared or unidentified.... am I missing any step?
EDIT:
What the class looks like so far is:
#pragma once
#include "main.h"
#include "include\fmod\fmod.hpp"
#include "include\fmod\fmod_errors.h"
#include "include\fmod\fmod.h"
class SoundMgr{
void init();
};
void SoundMgr::init(){
FSOUND_Init (44100, 32, 0);
}
And the error is:
Error 1 error C3861: 'FSOUND_Init': identifier not found
And that's for any line of the sample code that I try import from this quick guide:
GameDev FMOD quick guide
I tried adding the library as an additional dependency in the Input section of the Properties/Linker and I get
1. fatal error LNK1181: cannot open input file 'fmodex_vc.lib'
Any of these errors ring a bell?

Don't you want fmod.hpp to get the c++ features?

you can include the headers path in C/C++ > General and library path to Linker properties and include the dll's in you project. In this case you have the files in you release/debug dir

Right so I eventually fixed it by removing the Additional Dependency in the Input section of the Linker and instead adding Include and Library directories in in Configuration Properties\VC++ directories.... Most articles I found advise to use the actual full path to the FMOD installation folder, but since I want this project to be portable and self contained, i created a "lib" and "include" folder in my project and put those files in them... (used the directories "\lib" and "\include" in the project properties which I am assuming links to the project folder, have never done this before but am hoping it won't cause dependency issues if I compile this on a different machine)...

Related

Unable to include Magick++.h for image processing: "no such file or directory"

I'm setting up a c++ visual studio project to use ImageMagick's api, Magick++, for image processing. However, when I try to include <Magick++.h> in the only cpp file in the whole solution/project, I encounter this error:
fatal error C1083: Cannot open include file: 'Magick++.h': No such file or directory
I tried right-clicking Magick++.h in my code and pressing open document <Magick++.h>. This lead to an error message, which says the file is not found in current source file's directory or in build system paths. However, in the error message, the Build System Path clearly says the path to the include directory.
I have:
added the include directory of ImageMagick-7.0.9-Q16 in the project's properties->C/C++
->Additional Include Directories.
added the lib directory of ImageMagick-7.0.9-Q16 in the project's properties->Linker->Additional Library Directories
added CORE_RL_Magick++_.lib, CORE_RL_MagickCore_.lib, and CORE_RL_MagickWand_.lib in the project's properties->Linker->Additional Dependencies
Made sure everything is x64
Set the configuration to release
I somehow made Magick+++_demo project, the one that comes with magick++, work after tinkering with the settings. However, I cannot make other projects/solutions work. I have checked the settings of the demo project and tried to replicate it in my project where appropriate, but I cannot make my own project work.
this is the only code:
#include "pch.h"
#include <Magick++.h>
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
I have been googling and trying to make this work for the last 6 hours. Any help is hugely appreciated.

fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory

I am attempting to statically link GLEW to Visual Studio 2017. I followed a video tutorial exactly, but I still got an error:
fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
I have no idea what could be causing it. Here are the steps I took to link GLEW:
Put the folder named GLEW into a folder called dependencies in the solution directory
Went to C/C++, General and under "Additional Include Directories," I added $(SolutionDir)Dependencies\GLEW\include, which, when I go to edit, evaluates to the correct path
Went to Linker, General and under "Additional Library Directories," I added $(SolutionDir)Dependencies\GLEW\lib\Release\Win32, which also evaluates to the correct path
Went to Linker, Input and under "Additional Dependencies," I added glew32s.lib
Finally, I went to C/C++, Preprocessor and under "Preprocessor Definitions," I added GLEW_STATIC
I also did this same process with GLFW, and it worked perfectly, so I have no idea what the problem could be. I have checked and doublechecked the paths, so I am fairly certain that they are correct. Thank you in advance!
Sounds like you're doing
#include <GL/glew.h>
When you should be doing
#include <glew.h>
Is glew.h directly in the win32 folder? Or is there a further "GL" folder?

Adding libtomcrypt and libtommath to my c++ project

I am a C# developer, and spoiled rotten when it comes to references and dependencies. I am working on a small project now in Visual C++ (Visuial Studio 2017), where I want to use the libtomcrypt and libtommath libraries. I've created a small project and added the 2 projects to my solution:
I have also added my includes:
And I added the dependencies:
However, I still can't build:
Error C1083 Cannot open include file: 'tomcrypt.h': No such file or directory
I am not sure what else I need to do to get the references working and the code to compile. Any pointers is appreciated!
The error message indicates that the compiler can't find the file tomcrypt.h while compiling one of your source files. From the message I would guess that you have a line like the following in your source file:
#include <tomcrypt.h>
(...or perhaps with quotes instead of brackets.) From your screenshot I can see that you've added "...\repos\libtomcrypt-develop\src\headers" to your include path. Is the file tomcrypt.h found directly in that folder, or is it perhaps in a subfolder instead?
Your #include directive will basically append whatever path you give it to each entry in your include path when looking for the file, so if there are subfolders in between, you'll have to expand your #include directive to include those folders.
If this doesn't solve your problem, perhaps try posting the actual full path of where this header file exists on your filesystem, as well as your complete include path value! (The full compiler command from the build log would be useful, as well as the complete error message(s) related to this source file.)
Edit:
The original poster posted a separate answer indicating that the actual problem was that the Visual Studio Project Properties were set correctly, but that he was accidentally trying to build a different Configuration. :(
I was building the project under x86. Once I changed it to x64, it built just fine.

Dlib Error: error C1083: Cannot open include file:'type_safe_union/type_safe_union_kernel.h'

I'd like to use the image processing package of Dlib (C++ library) in Visual Studio 2013.
I created an empty project and added "dlib-18.16\dlib\all\source.cpp" to my Source Files in the Solution Explorer. Then, I added the path to dlib-18.16 to my Include Directories in VC++ Directories and I also added the path to dlib-18.16\dlib to my Additional Include Directories in C/C++ General of Visual Studio.
I can run the file matrix_ex.cpp which is one of the examples of Dlib, but I can't run the file face_detection_ex.cpp because of the error " Cannot open include file:'type_safe_union/type_safe_union_kernel.h' " which is actually caused by the line #include <dlib/image_processing/frontal_face_detector.h>
How can I resolve this issue? Why the program finds some header files but it can't find the others while they are all located in the same folder?
You need to add the dlib folder itself to the Include Directories in VC++ Directories, you instead added the folder above it.
By extension that would mean your include directive needs to be #include <image_processing/frontal_face_detector.h>.
Let me list a hypothetical example to explain better. You downloaded dlib-18.16.tar.bz2 and extracted it to c:\projects. This creates a folder named c:\projects\dlib-18.16. Within VC++ Directories you added c:\projects\dlib-18.16 to the Include Directories.
However this isn't correct, you should remove that directory and instead add c:\projects\dlib-18.16\dlib as that is the include directory for the project.
That will cause #include <type_safe_union/type_safe_union_kernel.h> to load C:\projects\dlib-18.16\dlib\type_safe_union\type_safe_union_kernel.h as well as similar internal links between files.

Mysterious relative path library dependency

After loading an existing MFC application in Visual Studio 2008, I am left with one linking error:
LINK : fatal error LNK1104: cannot open file '..\..\xpressmp\lib\xprm_rt.lib'
I have looked "everywhere", but I can't figure out where the relative path is set. The lib file is located in C:\xpressmp\lib, and I have added this directory both under Tools-Options->Projects and Solutions->VC++Directories->Library files and Project->Properties->Linker->Additional Library Directories. I also searched all files in the project to no avail.
I have the library file (xprm_rt.lib) listed under Additional Dependencies for both Debug and Release. I also tried adding the path there, but that did not help. I cannot find any #pragma comment-directives.
About the LNK1104, the file clearly does not exist in the location that the linker is searching. But I can't see why it is searching there (..\..\...) as I have not specified any relative paths.
Any help appreciated :-)
UPDATE:
In the project .vcproj file, I found the following xml:
<File RelativePath="..\..\XpressMP\lib\xprm_rt.lib"></File>
<File RelativePath="..\..\XpressMP\lib\xprs.lib"></File>
After deleting these lines (where were they set?), I was able to link successfully. Thanks for your help, it seems the relative library path was indeed being appended "automatically" by VS.
Thanks both of you, I think it was Nick that put me on the right track.
In the project properties, look under Configuration Properties -> Linker -> Input -> Additional Dependencies, for each of your project's configurations (Debug, Release, etc). Also, look for #pragma comment(lib, ...) directives in the code.
As you've added the C:\xpressmp\lib folder to the library search path in VC++ Directories, check that only the library file name is specified under Additional Dependencies, and this does not include the path (i.e, xprm_rt.lib, not ..\..\xpressmp\lib\xprm_rt.lib).
Also, have you tried each of the solutions in the LNK1104 error documentation?
It sounds like one of a couple possibilities to me:
The library itself is setting the lib include path via a #pragma comment(lib, ...) directive; search library headers to see if that's the case
You have a project for the library included in your solution which your main project is dependent on, and the relative library path is being appended automatically by VC; check the command line property page for the main project to see if that's the case
That's what I can think of which could cause the error; hope it helps.
Thanks for answering so swiftly!
I have the library file (xprm_rt.lib) listed under Additional Dependencies for both Debug and Release. I also tried adding the path there, but that did not help. I cannot find any #pragma comment-directives.
About the LNK1104, the file clearly does not exist in the location that the linker is searching. But I can't see why it is searching there (..\..\...)