How to link .lib file in Visual C ++ 2010? Without a link to the project?

I just have a problem that I have been trying to fix for the longest time.

I have a static library project in visual C ++, and I want another project to be able to reference it. So far, I have simply added a link to a static library project that automatically links the library.

I want to be able to reference the library using only the header files and the .lib file. However, I get the error "Unauthorized external character".

I thought I was doing it right - I specified the include directory, the library directory and went into the linker input properties and provided lib as an additional dependency.

I can link to other static libraries this way (e.g. SDL), so why do I get errors when I try to reference mine?

Thanks for the help.

Is the problem not a link to the actual lib file or something inside the library itself? These are the error messages I receive:

Error 2 LNK2019 errors: unresolved external character "public: void __thiscall XEngine :: XCore :: XScreen :: init (class XEngine :: XCore :: XGame &)" (? Init @XScreen @XCore @XEngine @@ QAEXAAVXGame @ 23 @ @Z) referenced by the function "void __cdecl XEngine :: XEngineInit (class XEngine :: XCore :: XScreen &, class XEngine :: XCore :: XGame &)" (? XEngineInit @XEngine @@ YAXAAVXScreen @XCore @ 1 @ AAVXGame @ 31 @@ Z) C: \ Users \ Xander Masotto \ Documents \ Visual Studio 2010 \ Projects \ Pong \ Pong \ source.obj Pong

3 LNK2019: "public: __thiscall XEngine:: XCore:: XScreen:: ~ XScreen (void)" (?? 1XScreen @XCore @XEngine @@QAE @XZ), "void __cdecl XEngine:: XEngineInit ( XEngine:: XCore:: XGame &)" (? XEngineInit @XEngine @@YAXAAVXGame @XCore @1 @@Z) C:\Users\Xander Masotto\Documents\Visual Studio 2010\Projects\Pong\Pong\source.obj

4 LNK2019: "public: __thiscall XEngine:: XCore:: XScreen:: XScreen (void)" (? 0XScreen @XCore @XEngine @@QAE @XZ), "void __cdecl XEngine:: XEngineInit ( XEngine:: XCore:: XGame &)" (? XEngineInit @XEngine @@YAXAAVXGame @XCore @1 @@Z) C:\Users\Xander Masotto\Documents\Visual Studio 2010\Projects\Pong\Pong\source.obj Pong

+5
1

, , , (, dll exe). .

.

#ifdef TESTLIB_EXPORTS
#define TESTLIB_API __declspec(dllexport)
#else
#define TESTLIB_API __declspec(dllimport)
#endif

, , , , :

1) , TESTLIB_EXPORTS . : ++//

2) TESTLIB_API , , :

class TESTLIB_API Order {
    void doSomething();
};
+4

All Articles