0

i make a static lib(.lib file) without "Precompiled header". and named project_1.

main.cpp

#include<iostream>
using namespace std; 
void display(void);
int main()
{
   cout<<"test_main\n";
   display();
   return 0;
} 

display.cpp

 #include<iostream>
 using namespace std; 
 void display(void) 
 { 
     cout<<"display\n"; 
 }

and build this project("win32 release") and copy .lib file to another project and ok. at now i want use this .lib file. at now make project_2.(show below) and know to compiler test.lib with this:

linker->input->Additional Dependencies->test.lib

and copy test.lib file at same folder with main.cpp(path main.cpp and test.lib is same).

main.cpp

//#include<iostream>       // ERROR 
using namespace std; 
void display(void);
int main()
{
   display();
   return 0;
} 

but when write any #include<...>(example==> #include<iostream>) at main.cpp, compiler make ERROR.

also, if remove display(); at main.cpp, compiler make Succeeded.

i use VS2012, and other problem, at VC++6 this problem not!.

what i do?

List of ERROR:

error LNK1319: 2 mismatches detected...

error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.ob....

error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj....

  • 1
    Important piece is missing: what ERROR exactly you are getting. – Roman R. Aug 10 '14 at 07:05
  • i write error list at end of my post. – nimanabavi321 Aug 10 '14 at 07:25
  • 3
    You are trying to link code that was compiled with completely wrong settings. A Debug build of a static library most likely. With the wrong compiler version as well, looks like VS2010. Instead of a *very* nasty crash at runtime, you get a link error instead. Contact the owner of the library and ask for an update. And don't forget to ask for *both* a debug and a release build version. – Hans Passant Aug 10 '14 at 07:36
  • What is the error in when use #include <...>? – nimanabavi321 Aug 10 '14 at 07:39

0 Answers0