Tag Archives: visual-studio

error C1189: #error : Please use the /MD switch for _ Afxdll builds — solutions

The general method found on the Internet is to change “property page – & gt; configuration property – & gt; C/C + + – & gt; code generation – & gt; runtime” from “multi thread (/ MT)” to “multi thread DLL (/ MD)”.
MT is a static compilation option, while MD is a dynamic compilation option. What if you want to compile statically?

In fact, while setting “runtime” to MT, you can change “property page – & gt; configuration property – & gt; general – & gt; use of MFC” to “use MFC in static library”
.
IntelliSense: error instruction: please use the/MD switch for_ Afxdll builds – Solutions – ordinarydilligent – Zhang Sir’s blog

IntelliSense: error instruction: please use the/MD switch for_ Afxdll builds – Solutions – ordinarydilligent – Zhang Sir’s blog

Similarly, if you want to compile dynamically, for:
error 1, error C1189: # error: building MFC application with/MD [D] (CRT DLL version) requires MFC shared DLL version. Please define_ AFXDLL or do not use /MD[d]

You need to set “property page – & gt; configuration property – & gt; general – & gt; use of MFC” to “use MFC in shared DLL”, and set “property page – & gt; configuration property – & gt; C/C + + – & gt; code generation – & gt; runtime” to “multithreaded DLL (/ MD)”

Supplement: (/ MD) and (/ MT) are used to compile release version, (/ MDD) and (/ MTD) are used to compile debug version

error C2065: ‘cout’ : undeclared identifier

question:

online solution:
1. No

added

#include <iostream>
using namespace std;

or
2. The order of the included libraries needs to be adjusted

//These will not work.
#include <iostream>
using namespace std;
int main () {
    cout << "hey" << endl;
    return 0;
}
#include <iostream>
#include "stdafx.h"
using namespace std;
int main () {
    cout << "hey" << endl;
    return 0;
}
//This will do.

#include "stdafx.h"
#include <iostream>
using namespace std;
int main () {
    cout << "hey" << endl;
    return 0;
}

final solution: my own reasons… Orz)
open iostream file. I commented out part of the code for a project…
just uncomment it.