yanzilisannjuanji.obj : error LNK2001: unresolved external symbol "double * ynum" 编译出错,请问为啥啊?

main - C++ error LNK2001: unresolved external symbol function _main - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
Possible Duplicate:
I'm learning C++ and I have a compiling problem in my project.
I have read tons of post with this error on the title but I cant find where the problem is.
I have a method call in my Main function that is responsible for the error. Whenever I comment the line the project compiles perfect.
The code is the following:
#pragma once
#include "stdafx.h"
#include &iostream&
#include &sstream&
#include &WinSock.h&
#include &Windows.h&
#include &string.h&
#include "NetUtils.h"
#include "Utils.h"
#include "FileUtils.h"
#include "SendMail.h"
int _tmain(int argc, _TCHAR* argv[])
SendMail *mail = new SendMail("","Envio de C++","Cuerpo del mail");
char* msg="";
mail-&SendNow();
This method mail->SendNow is the one I comment to solve the problem, so I guess
I have some kind of header declaration problem inside of SendMail.cpp or SendMail.h
Now the rest of the classes and headers:
SendMail.h
#pragma once
#ifndef SENDMAIL_H
#define SENDMAIL_H
class SendMail
SendMail(char* c_to, char* c_subject, char* c_body);
void Check(int iStatus, char *szFunction);
void SendNow();
SendMail.cpp
#define WIN32_LEAN_AND_MEAN
#pragma once
#include "SendMail.h"
#include &stdio.h&
#include &stdlib.h&
#include &fstream&
#include &iostream&
#include &windows.h&
#include &winsock2.h&
#pragma comment(lib, "ws2_32.lib")
// Insist on at least Winsock v1.1
const int VERSION_MAJOR = 1;
const int VERSION_MINOR = 1;
#define CRLF "\r\n"
// carriage-return/line feed pair
SendMail::SendMail(char* c_to, char* c_subject, char* c_body)
subject= c_
// Basic error checking for send() and recv() functions
void Check(int iStatus, char *szFunction)
if((iStatus != SOCKET_ERROR) && (iStatus))
cerr && "Error during call to " && szFunction && ": " && iStatus && " - " && GetLastError() &&
void SendNow()
// WSADATA
///* Attempt to intialize WinSock (1.1 or later)*/
if(WSAStartup(MAKEWORD(VERSION_MAJOR, VERSION_MINOR), &WSData))
cout && "Cannot find Winsock v" && VERSION_MAJOR && "." && VERSION_MINOR && " or later!" &&
ErrMsg="Cannot find Winsock v";
AS you can see the method Send is commented out so I cant figure out what the problem is.
The compiler output is:
error LNK1120: 1 unresolved externals
C:\Users\clanderasm\Documents\Visual Studio 2010\Projects\LandeTestConsole\Debug\LandeCplusConsole.exe
LandeCplusConsole
error LNK2019: unresolved external symbol "public: void __thiscall SendMail::SendNow(void)" (?SendNow@SendMail@@QAEXXZ) referenced in function _main
C:\Users\clanderasm\Documents\Visual Studio 2010\Projects\LandeTestConsole\LandeCplusConsole\LandeCplusConsole.obj
LandeCplusConsole
10.6k1485162
7,78272759
marked as duplicate by , Fraser, , ,
This question has been asked before and already has an answer. If those answers do not fully address your question, please .
Did you mean
void SendMail::Check(int iStatus, char *szFunction)
void SendMail::SendNow()
instead of
void Check(int iStatus, char *szFunction)
void SendNow()
161k26277441
Basically what that error means is that you have a function that you promise to implement in your header, but when it got to the part where it actually needed the function, it didn't find it.
If you comment out the function call, the promise that you will implement that function is still there. However, nobody is actually using the function, so it doesn't matter that you don't come through on your promise.
Once you know that it means, it's pretty easy to find what is wrong:
You are defining the function as:
void SendNow()
This is a global function and not a class function, as such you have not implemented the class function you promised to implement.
You can fix this by turning it into:
void SendMail::SendNow()
Do note that you have the same problem in Check() even though that's not causing an error yet.
6,19752249
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledc++ - Error: Unresolved external symbol - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
I'm supposed to write a program that reads in a length in feet and inches and outputs the equivalent length in meters and centimeters. Use at least three functions: one for input, one or more for calculating, and one for output. Include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program. Google for conversion between different units. The thing is I'm supposed to use call by reference functions.
So, I've tried it, but I keep getting this error:
error LNK2019: unresolved external symbol "double __cdecl convert(double,double)" (?convert@@YANNN@Z) referenced in function _main
I've never had this error before so I don't even get what it's telling me. I'm going to put the loop in after I solve this problem because I know how to do that already. Thank you.
#include &iostream&
#include &conio.h&
int bLength, sL
length(double bLength, double sLength);
conv(double bLength, double sLength);
output(double bLength, double sLength);
int main()
length(bLength, sLength);
conv(bLength, sLength);
output(bLength, sLength);
void length(double bLength, double sLength)
cout&&"Enter a length in feet, then enter a length in inches if needed: ";
cin&&bLength&&sL
double conv(double bLength, double sLength)
bLength = bLength * 2.54;
sLength = sLength * .3048;
void output(double bLength, double sLength)
cout&&"Your input is converted to "&&bLength&&" meters, and "&&sLength&&"
centimeters.";
Your function definition and declaration do not match.
convert(double bLength, double sLength);
And you implement it thus.
double conv(double bLength, double sLength)
//code runs here
Note the difference in function name.
3,16951542
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledc语言中链接错误提示error LNK2001: unresolved external symbol _WinMain@16怎么修改?_百度知道
c语言中链接错误提示error LNK2001: unresolved external symbol _WinMain@16怎么修改?
int num[]){ MAX,使得插入后的序列依然按从大到小排序#include&i++) {scanf(&MAX;;i++) {pos=i;);}main(){ }
num[pos1]=y; for(i=0;i&lt,怎么改;} printf(&quot,int num[]){ %d& scanf(&quot.h&}y; for(i=pos1;#define MAX 6int search(int y,num[i]),%d&quot,再插入x;i++) {num[i+1]=num[i],但是链接提示错误; insert(x;,}void insert(MAX-1:& pos=search(x;%d&quot,i;
for(i=0,int pos1;),pos,num[MAX];
for(i=0?求大神~~~~程序要求按从小到大顺序输入序列后;i++)
{printf(&i&lt,num);,&x);i&lt,&num[i]);stdio:&quot,num);num[i]& printf(&quot编译通过了
是依然从小到大
提问者采纳
在vc6下用cl可以直接编译成功。报错是因为你的工程建的不对,应该建立一个控制台程序工程,否则用不到winmain这个入口函数
提问者评价
其他类似问题
为您推荐:
其他2条回答
console&quot, &quot#pragma comment(&#47
可能是因为你代码中有全角输入的东西:比如空格。一般网上自己复制的代码会这样
winmain的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 danjuanjipifa 的文章

 

随机推荐