2

I followed this tutorial: https://cmusphinx.github.io/wiki/tutorialpocketsphinx/#initialization and builded up these 2 Files in VS.

Now i want to use the library in my project but I don't know how to bind it in Visual Studio.

Can someone help me please?

Thanks in advance

Ossi
  • 75
  • 11
  • I believe a few more details might be needed - the tutorial you linked leads to C++ code, are you trying to reference the DLL it builds into (COM), or simply add the code files to your existing project? Is your project in Visual Studio also C++? It becomes more complicated if it's .NET (C#). – Porschiey Jul 11 '17 at 18:42
  • I've never done somthing like this, so I am not sure which one would be better. My Project would be in C# – Ossi Jul 11 '17 at 18:59
  • Possible duplicate of [Adding C++ DLL's to a C# project](https://stackoverflow.com/questions/2889392/adding-c-dlls-to-a-c-sharp-project) – Nikolay Shmyrev Jul 11 '17 at 20:29
  • 1
    [Why is “Can someone help me?” not an actual question?](http://meta.stackoverflow.com/q/284236) – EJoshuaS - Stand with Ukraine Jul 11 '17 at 23:47

1 Answers1

2

If you've successfully compiled the C++ items into a single library file (DLL), you can reference the DLL in another project in Visual Studio using the Add Reference Option.

Be warned however, by doing so you're now mixing different 'technologies', and may run into issues. You may find it difficult to use the library you've just referenced, as you can see in this other question.

I would recommend to actually stick with C++, since the original files you started with in this library are C++. You can easily program C++ in Visual Studio as well (just create C++ project that's appropriate to your solution). You can also create a separate project in your solution to house these other files you've created externally, and VS will build/compile them for you as well.

In summary, try creating a new solution in Visual Studio with two projects:

  1. A C++ library project to house your C++ files already made
  2. A C++ application (of whatever type) that will use the C++ library just made.

If you follow my recommendation, you can use the Add Reference option previously stated above to add the library reference (#1) to the application project (#2) as a "Project Reference."

Regardless, you may want to take some free courses on C++ and Visual Studio to get you more familiar with the environment. Pluralsight, Lynda, are just a few I can name off the top of my head. Good luck!

Porschiey
  • 1,981
  • 2
  • 17
  • 25
  • Now my project is in C++ but i still can't import the librarys. Can you explain me how can i Import the Pocketsphinx library into Visual Studio/ my project. If i want to import the DLL.. i get this error:A reference to ".." could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component. – Ossi Jul 12 '17 at 08:43
  • If you have the original files that were compiled to make that DLL I recommend just putting those into a separate project in Visual Studio (within the same Solution) and reference the library as a project reference. Also, please refer to the comments above... this site isn't really meant to be a tutorial site in the Q&A section :) – Porschiey Jul 12 '17 at 15:23