I am creating Visual Studio VC++ app project on Win 7, that utilizes the libsndfile library.
The library( libsndfile-1.dll,libsndfile-1.dll) is at :
C:\SVN\US\AdditionalIncludeDir\libsndfile
and its headers(sndfile.hh,sndfile.h) at
C:\SVN\US\AdditionalIncludeDir\Include
the Visual Studio Project is at :
C:\SVN\US\Simulation\audioSim.vcxproj
I have added the library header reference as:
Project properties->C/C++->General->Additional Include Directories->
..\AdditionalIncludeDir\Include
and static lib reference as
Project properties->Linker>Additional dependencies:
libsndfile-1.lib
Project properties->Linker>Additional Library
Dir:..\AdditionalIncludeDir\libsndfile
I also have added
..\AdditionalIncludeDir\libsndfile
to path in user environment variable in Win 7.
The toplevel C++ file uses the library as:
SndfileHandle mic1(".\\filedata\\mic1.wav");
where mic1.wav is at
C:\SVN\US\Simulation\filedata
Building the project still gives me error:
error LNK2019: unresolved external symbol _sf_open referenced in
function "public: __thiscall SndfileHandle::SndfileHandle(char const
*,int,int,int,int)" (??0SndfileHandle##QAE#PBDHHHH#Z)
Why would this happen?
Thanks
sedy
I also had this problem. I had set "Additional Include Directories" (C:\Program Files (x86)\Mega-Nerd\libsndfile\include) and "Additional Library Directories" (C:\Program Files %28x86%29\Mega-Nerd\libsndfile\lib) in the project settings.
This fixed the problem:
Go to project properties -> Configuration properties -> Linker -> Input and type in the lib file name libsndfile-1.lib in the "Additional Dependencies" field.
Related
I'm new to CMake and also new to compiling mixed source, I have received the following errors while trying to compile using CMake and Visual Studio 14.0
(Link target) ->
main.obj : error LNK2001: unresolved external symbol ethash_get_cachesize
main.obj : error LNK2001: unresolved external symbol ethash_get_datasize
The layout of my project is like this:
I have ethash_get_cachesize and ethash_get_datasize defined in internal.c in a directory ethminer/libethash/ these are C source. im sure that the CMake file that came with this set of sources is ok as the project has compiled before without issue, it has only given me LINK problems after i have added the following:
I have another directory /ethminer/dag/ with a C++ source "dag.cpp" and "dag.h" these are both C++ files. and the CMake file.
set(SOURCES
DAG.h DAG.cpp
)
include_directories(BEFORE ..)
link_directories(BEFORE ..)
the C++ source file "dag.cpp" includes #include <libethash/internal.h>
however I fear that I am missing something to tell CMake or Visual Studio to find the files it needs from the directory containing "internal.c"
any help would be much appreciated
I'm having trouble to compile VTK 5.10.1 example code in Visual Studio 2010 on Windows 7 64 bit SP1.
First of all, I installed VTK using this tutorial.
No errors occured while installing VTK and the example executables like cone.exe located at C:\VTK5.10.1_cmake\bin\Release are running just fine.
In Visual Studio 2010 I started a new Win32 console application and tested the first example code from this site.
I edited the projekt properties (additional include directories, additional Library directories and additional dependencies).
The linker errors looked like that:
vtktest.obj : error LNK2019: unresolved external symbol ""public: void __thiscall vtkRenderer::AddActor(class vtkProp *)" (?AddActor#vtkRenderer##QAEXPAVvtkProp###Z)" referenced in function "_main".
Most of the the other people with the same error forgot to add the libs to the additional dependencies.
However I added all libs in the C:\VTK5.10.1_bin\lib\vtk-5.10 directory and the opengl32 library. I tried to seperate the libs by a space, a semicolon and a new line.
Then, I read that people are using the shared libraries. I'm not really familiar with dlls. I reinstalled VTK
with shared libraries options turned on and copied the resulting dlls to the System32 directory.
Now, the errors looks slightly different:
vtktest.obj : error LNK2019: unresolved external symbol ""__declspec(dllimport) public: void __thiscall vtkRenderer::AddActor(class vtkProp *)" (__imp_?AddActor#vtkRenderer##QAEXPAVvtkProp###Z)" referenced in function "_main".
Any help would be appriciated!
Nevermind, forgot to change the platform to x64 :/
I'm using CMake to build a Qt based application of mine on Windows with Visual Studio 2010 Express. When configuring with cmake I get the following error:
System runtime library file does not exists:
'MSVC10_REDIST_DIR-NOTFOUND/x86/Microsoft.VC100.CRT/msvcp100.dll
System runtime library file does not exists:
'MSVC10_REDIST_DIR-NOTFOUND/x86/Microsoft.VC100.CRT/msvcr100.dll
Then when I try to compile, I'm getting this error (both trying in Visual Studio, and with msbuild):
MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
C:\Users\Kurtis\sandbox\UDJ-Desktop-Client\build\src\Release\UDJ.exe : fatal error LNK1120: 1 unresolved externals
I determined that Microsoft Visual C++ 2010 Express doesn't come with the redistributable that I need. So I went to Microsoft's website to download the redistributable (both for x86 and x64). However, after installing it, I'm still getting the above configure and compile errors. Does anyone know what I'm doing wrong, or how to fix my problem?
_WinMain#16 is the entry point of a Windows GUI application, so either it's missing from your source code, or you're not writing a GUI application, in which case your linker flags are incorrect.
Since you're using qt, make sure you have the QtMain Library being linked with your project. You can do this by adding it in your call to Find_Package like so:
find_package(Qt4 4.7.0 COMPONENTS QtMain QtCore QtGui QtSQL Phonon REQUIRED)
I have received a Visual C++ QT based project from our customer. I have installed QT libraries then I have compiled the project. The Project was compiled without any problems.
Now, I need to include a new additional GUI interface with the existing project. I have created a GUI in QT designer then saved in the source directory of VC++ project. Then I have written .h and .cpp file for new GUI and could call this interface. Now I need to include SIGNALS and SLOTS, when I include Q_OBJECT in .h file. I have compilation error.
These are the errors, please help me to solve this problem:
unresolved external symbol "public: virtual struct QMetaObject const * __thiscall BetaLineServer::metaObject(void)const " (?metaObject)
unresolved external symbol "public: virtual void * __thiscall BetaLineServer::qt_metacast(char const *)"
unresolved external symbol "public: virtual int __thiscall BetaLineServer::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#
Any time you add a Q_OBJECT macro to a class you need to be sure to rerun qmake and then compile.
All you need is to compile the header files with moc that contain Q_OBJECT macro. And how to do that? here it is
You can manually type commands for compiling moc or uic files OR
-> Install Qt-VS addin. http://qt.nokia.com/downloads/visual-studio-add-in
-> Now, open visual studio and create a new Qt project as described in here and then
-> Right click on a header file that contains the Q_OBJECT macro you should find something like below. Copy these commands into your project.
-> Replace the header file name with yours in the 'Command Line' command
-> compile once and that should generate moc_xxxxx.cpp files, include them in your project.
For future reference, if you create a Qt project in VS using this plugin you should have these commands automatically added
You probably just need to add your .ui, .cpp and .h files to the project file.
Qt will run 'moc' on the ui file if it's listed there, which creates source code to supply your missing symbols.
Exclude .h file from the project and include it again - moc_.cpp will appear in the "Generated Files", and linking errors are disapeared.
In visual studio 2008, I have created a static dll called test_static.dll. I am trying to call this from one application. I have included this dll in source files folder and the header file related to it in headers folder. When i am running the application I am getting following liking error. Please give me a solution.
error LNK2019: unresolved external
symbol "struct morph_output * __cdecl
morpho_data(struct morph_input *)"
(?morpho_data##YAPAUmorph_output##PAUmorph_input###Z)
referenced in function _wmain
1>D:\test_app\Debug\test_app.exe :
fatal error LNK1120: 1 unresolved
externals 1>Build log was saved at
"file://d:\test_app\test_app\Debug\BuildLog.htm"
Here test_app is application that is using static dll. and morpho_data is the dll function which is taking input as structure and returning another structure.
When compiling the dll you need to create an import library - a .lib file (Linker->Advanced->Import Library) and include it into the list of libraries your .exe depends on (Linker->Input->Additional Dependencies and Linker->General->Additional Library Directories).
Did you add test_static.lib as input to the linker in the project settings?
Did you include the header file where the function is declared ?