dllimport


Unresolved external symbol


I have two WIN32 DLL projects in the solution, main.dll should call a function in mgn.dll.
mgn.dll has mgn.h header file:
#ifdef MGN_EXPORTS
#define MGN_API __declspec(dllexport)
#else
#define MGN_API __declspec(dllimport)
#endif
extern "C" bool MGN_API AttachMGN(void);
and mgn.cpp source file:
#include "stdafx.h"
#include "mgn.h"
MGN_API bool AttachMGN(void)
{
...
}
main.dll calls AttachMGN function from one of the source file:
#include "stdafx.h"
#include "..\mgn\mgn.h"
bool CreateClient()
{
return ::AttachMGN();
}
mgn.dll compiles successfully. main.dll doesn't show any errors in VS text editor, I can navigate using "Go To Definition" function. However during build I get the error:
error LNK2019: unresolved external symbol __imp__AttachMGN referenced in function "bool __cdecl CreateClient(void)" (?CreateClient##AW4XZ)
Both DLLs compile into the same folder. DependencyWalker shows the function AttachMGN as exported. Main project has a dependency set to Mgn project, if that matters.
I believe that I simply have overlooked something....
Thanks in advance.
You probably just forgot to add MGN.lib to your link arguments for main.dll
Is your mgn.lib linked with the main? By the sound of it, it looks as if main cannot find the lib file to link against the DLL.

Related Links

Cannot create automation object - lotusscript
DllImport is not found C++
Mangled member function name different during dllimport
how to use DllImport in metro-style app
Converting doc file to post script
How can I get a COM component which can be used on Windows phone 8 project with C#
Externs and DLL imports
Mixed native and managed code heap corruption
MarshalDirectiveException
call unmanaged C++ code from C# using pinvoke
Detecting DLL Code Splicing
WOW64 Redirection and LoadLibrary
Using C# dll in Windows phone 7
Python 2.5 Import dll AttributeError
Replacing the Import Table in PE file by standart LoadLibrary
Unresolved external symbol

Categories

HOME
jpa
hyperlink
prism
ggplot2
ecmascript-6
gpu
datastore
case
jelastic
jsf-2.2
replace
pyqt4
data-visualization
vert.x
character
heap
rtf
php-5.6
supervisor
scrolltop
altera
internationalization
git-extensions
swagger-2.0
php-mysqlidb
displaytag
jquery-multiselect
shared
rpgle
google-earth
nsurl
gitlab-api
cognos-bi
deltaspike
turfjs
angularjs-material
nested-lists
amazon-ses
password-protection
hackintosh
levenshtein-distance
parser-generator
rfc3339
fwrite
openrasta
identification
lightning
excel-dna
css-transforms
lsyncd
sandcastle
chromium-os
actor-platform
preprocessor
qtplugin
segment-io
burrows-wheeler-transform
windows-azure-queues
nikeplus-api
refinerycms
qiime
cda
boost-serialization
cortex-m
pushbots
np-spring
vhosts
toran-proxy
lazybones
android-launcher
pax-exam
iced-coffeescript
vacuum
canvg
mraid
bcache
qtwebengine
nodelist
browserify-shim
spy++
punycode
kissfft
live555
jjaql
getopt
printdialog
cnf
diem
pclzip
wp7test
insert-id
mantle
robotlegs
idn
android-loadermanager
uimanageddocument
wcf-configuration
window-decoration
wiimote
entity-attribute-value
expression-blend-4
matlab-load
fsevents
codebase
addchild
tabpanel
pos-for-.net
asynchronous-wcf-call
todos
application-planning
lemmatization
image-capture

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App