极简单程序VC++生成出错!!!急!!

来源:百度知道 编辑:UC知道 时间:2024/05/30 23:04:24
我在学程序文件的用法,我编译了一个不程序,有几个头文件和几个源文件,后来用VISUAL 2005'编译'时显示生成成功,但'生成'时,却显示下面的信息!!我是个刚学C++的初学者,望能讲的详细点!

错误 1 fatal error LNK1104: 无法打开文件“libcpd.lib”

源程序如下:
//print.h
#include <iostream>
#include <string>
using std::string;

#ifndef print_h
#define print_h
void print(string&s);
#endif
//print.cpp
#include <iostream>
#include "print.h"
#include <string>
using std::cout;
using std::string;

void print (const string&s)
{
cout<<s;
return;

}
//print_this.h
#include <iostream>
#include <string>
using std::string;

#ifndef print_this_h
#define print_this_h
void print_this (string &s);
#endif
//print_this.cpp
#include <iostream>
#include <string>
#include "print.h"
using std::string;

void print_this

在程序开头处加一句:
#pragma comment(lib, "libcpd.lib")

要是还不行,再把debug或Release目录下的所有零时文件全删除,然后再编译试试

如果还是不行,看看是不是libcpd.lib不在你的程序工程目录下,必须要拷贝到程序工程目录下

再不行的话......
偶也不知道了