Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/laborary.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.一个很简单的程序 编译通过了是不是我的VC有问题? 下面是程序的代码 很简单的 #include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <Afx.h>class Book {private : char m_name[50] ;
char m_author[50] ;
char m_publisher[50] ;
float m_price ;
public :
//Constructors
Book(){
cout << "A new book has been created ." << endl ;
} Book(char name[], char author[], char publisher[], float price){
Book() ;
strcpy(m_name,name) ;
strcpy(m_author,author) ;
strcpy(m_publisher,publisher) ;
m_price = price ;
} //Save the information to the file which is specified by the fileName .
void saveBook(char fileName[]){ cout << m_name << "\t" << m_author << "\t" << m_publisher << "\t" << m_price << endl ;
FILE *fp ;
if((fp = fopen(fileName,"a")) == NULL){
cout << "Can't open the file : " << fileName << endl ;
return ;
}
fprintf(fp ,"\n%s,\t,%s,\t,%s,\t,%f,\n",m_name,m_author,m_publisher,m_price) ;
fclose(fp) ;
}
//Set functions
void setName(char* name){
strcpy(m_name,name) ;
} void setAuthor(char* author){
strcpy(m_author,author) ;
}
void setPublisher(char* publisher){
strcpy(m_publisher,publisher) ;
} void setPrice(float price){
m_price = price ;
} //Get functions
char* getName(){
return m_name ;
} char* getAuthor(){
return m_author ;
} char* getPublisher(){
return m_publisher ;
} float getPrice(){
return m_price ;
}
} ;void main(){ Book book("C ++ Primer " , "Stroustru" , "China-pub" , 128.00) ;
book.saveBook("d:\\hfj.txt") ;
}
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/laborary.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.一个很简单的程序 编译通过了是不是我的VC有问题? 下面是程序的代码 很简单的 #include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <Afx.h>class Book {private : char m_name[50] ;
char m_author[50] ;
char m_publisher[50] ;
float m_price ;
public :
//Constructors
Book(){
cout << "A new book has been created ." << endl ;
} Book(char name[], char author[], char publisher[], float price){
Book() ;
strcpy(m_name,name) ;
strcpy(m_author,author) ;
strcpy(m_publisher,publisher) ;
m_price = price ;
} //Save the information to the file which is specified by the fileName .
void saveBook(char fileName[]){ cout << m_name << "\t" << m_author << "\t" << m_publisher << "\t" << m_price << endl ;
FILE *fp ;
if((fp = fopen(fileName,"a")) == NULL){
cout << "Can't open the file : " << fileName << endl ;
return ;
}
fprintf(fp ,"\n%s,\t,%s,\t,%s,\t,%f,\n",m_name,m_author,m_publisher,m_price) ;
fclose(fp) ;
}
//Set functions
void setName(char* name){
strcpy(m_name,name) ;
} void setAuthor(char* author){
strcpy(m_author,author) ;
}
void setPublisher(char* publisher){
strcpy(m_publisher,publisher) ;
} void setPrice(float price){
m_price = price ;
} //Get functions
char* getName(){
return m_name ;
} char* getAuthor(){
return m_author ;
} char* getPublisher(){
return m_publisher ;
} float getPrice(){
return m_price ;
}
} ;void main(){ Book book("C ++ Primer " , "Stroustru" , "China-pub" , 128.00) ;
book.saveBook("d:\\hfj.txt") ;
}
Libraries:
Multithreaded versions of the C run-time libraries only.
To use _beginthread or _beginthreadex, the application must link with one of the multithreaded C run-time libraries.
最下面的框里+上
/MT /D "_X86_" /c
如果你工程建立用的是WINDOWS APPLICATION:porject->setting中general页中选择“using mfc in a shared dll”