|
-
October 29th, 2008, 05:33 AM
#1
LNK2019 error
Hi everyone, new here and hoping for some advice with the following problem. I only write code in a "need to know basis" way, and am very naive about the extensive compiler options and preprocessor stuff that goes on.
Summary: I am trying to use some downloaded libraries in some code I am working on; I thought I'd properly included the files but the linker is giving me a 2019 error.
For simplicity I am presently just trying to compile the sample code that came with one of the libraries (though I'm having the same problem with another library as well). Specifically, the library is for high-precision arithmetic and is available here (QD, second package from the top): http://crd.lbl.gov/~dhbailey/mpdist/
I'm using Visual c++ 2008 express edition. I put the /src files from the library in a folder, made sure the compiler knew to look there for headers (Tools -> Options -> Projects and Solutions -> VC++ directories, and added the path to the list of include files), opened a "test" solution and added all the files in /src to it's "header" directory (VC++ has a little "solution explorer" window for doing this; I'm not sure why it's necessary if the files are properly #included anyway). Then I tried to compile the following code, which was in the library's documentation:
Code:
#include <iostream>
#include <qd/qd_real.h>
using namespace std;
int main() {
qd_real a, b, c;
cout << "Enter a:";
cin >> a;
cout << "Enter b:";
cin >> b;
c = a + b;
cout << "a + b = " << c << endl;
cout << "sin(c) = " << sin(c) << endl;
return 0;
}
Should be straightforward enough, but when I try to build I get the following errors:
Code:
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>Linking...
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct qd_real __cdecl sin(struct qd_real const &)" (__imp_?sin@@YA?AUqd_real@@ABU1@@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,struct qd_real const &)" (__imp_??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABUqd_real@@@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct qd_real __cdecl operator+(struct qd_real const &,struct qd_real const &)" (__imp_??H@YA?AUqd_real@@ABU0@0@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_istream<char,struct std::char_traits<char> > & __cdecl operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,struct qd_real &)" (__imp_??5@YAAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV01@AAUqd_real@@@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall qd_real::qd_real(void)" (__imp_??0qd_real@@QAE@XZ) referenced in function _main
1>C:\Documents and Settings\Customer.CUSTOMER2007\My Documents\Visual Studio 2008\Projects\test\Debug\test.exe : fatal error LNK1120: 5 unresolved externals
1>Migdal - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm not sure what any of this really means and expect it's a subtlety related to the preprocessor or to the library needing to be updated for VC++ 2008 or something.
Any helpful thoughts? I've already tried playing with the Linker subsystem (switching from "windows" to "console" or back), which didn't help.
Thanks so much for taking the time to look.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|