Guest User

Untitled

a guest
Aug 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Prevent mixing debug and release libraries
  2. //header:
  3. class DLLIMPEXP Dummy
  4. {
  5. static int x;
  6. virtual void dummy();
  7. }
  8. //cpp
  9. #ifdef DEBUG
  10. int Dummy::x = 0;
  11. void Dummy::dummy()
  12. {
  13. }
  14. #endif
  15.  
  16. #ifdef NDEBUG
  17. namespace project {
  18. #else
  19. namespace project { namespace debug {
  20. #endif
  21.  
  22. // content
  23.  
  24. #ifdef NDEBUG
  25. }
  26. #else
  27. }
  28. using namespace debug;
  29. }
  30. #endif
  31.  
  32. myLib.h // Release Version
  33. myLibd.h // Debug Version
  34.  
  35. #ifndef _DLL
  36. // C runtime as dll
  37. # ifdef _DEBUG
  38. # pragma comment(lib, "MyLibD.lib")
  39. # else
  40. # pragma comment(lib, "MyLib.lib")
  41. # endif
  42. #else
  43. // C runtime statically
  44. # ifdef _DEBUG
  45. # pragma comment(lib, "MyLibSD.lib")
  46. # else
  47. # pragma comment(lib, "MyLibS.lib")
  48. # endif
  49. #endif
  50.  
  51. #ifndef _DLL
  52. // C runtime as dll
  53. # ifdef _DEBUG
  54. # pragma comment(lib, "debug/dynamic/MyLib.lib")
  55. # else
  56. # pragma comment(lib, "release/dynamic/MyLib.lib")
  57. # endif
  58. #else
  59. // C runtime statically
  60. # ifdef _DEBUG
  61. # pragma comment(lib, "debug/static/MyLib.lib")
  62. # else
  63. # pragma comment(lib, "debug/static/MyLib.lib")
  64. # endif
  65. #endif
Add Comment
Please, Sign In to add comment