导航:首页 > 程序命令 > 无法解析的外部命令

无法解析的外部命令

发布时间:2022-01-17 13:37:52

1. 1 个无法解析的外部命令

没细看你的程序,至少main()函数就有好几个问题 1、函数里面不能有 int (double,double,double)这样的其他函数的声明,应该放在函数外部,除了main()

2. c语言无法解析的外部指令

int main()
主函数没有定义,这是不应该犯的错误

3. c++,编程,出现无法解析的外部指令

//client.h#ifndef _client_#define _client_#include#includeusing namespace std;class CLIENT{ public: CLIENT(){ ClientNum++;} static void showClientNum(); private: static string ServerName; static int ClientNum; static void ChangeServerName(string newName); };#endif//client.cpp// 此处不能再次使用#ifndef.....#endif// 不然client.h中的内容会被丢弃。就像一楼说的那样#include "client.h"#include#includeusing namespace std;string CLIENT::ServerName="MY Client";int CLIENT::ClientNum=0; void CLIENT::ChangeServerName(string newName){ ServerName=newName;}void CLIENT::showClientNum(){ cout<<"客户数量为"<#include#include"client.h"using namespace std;void main(){ CLIENT c1; CLIENT::showClientNum(); CLIENT c2; CLIENT::showClientNum(); system("pause");}

4. vs2013中出现“无法解析的外部命令”是怎么回事

错误 1 error LNK2001: 解析外部符号 "public: __cdecl App1::App::App(void)" (??0App@App1@@QE$AAA@XZ) c:\Users\sectumsampra\documents\visual studio 2013\Projects\App1\App1\XamlTypeInfo.g.obj App1
何处理

5. C++编译出现“无法解析的外部命令”错误提示!

#include<iostream>
using namespace std;
template <class T>
class Seqlist
{
private:
T*element;
int size;
int len;
public:
Seqlist(int size=64);
Seqlist(T value[],int n);
~Seqlist();
bool isEmpty();
int length();
T get(int i);
bool set(int i,T x);
template <class Type>
friend ostream& operator<<(ostream& out,Seqlist<Type>& list);
void insert(int i,T x);
void insert(T x); //表后插入
bool remove(int i,T& old); //删除第i个元素存入old中
void clear();
};
template<class T>
Seqlist<T>::Seqlist(int size)
{
this->size=size<64?64:size;
this->element=new T[this->size];
this->len=0;
}
template<class T>
Seqlist<T>::Seqlist(T value[],int n)
{
if(n>0)
{
this->element=new T[2*n]; //Ensure to have enough room to insert
this->size=2*n;
for(int i=0;i<n;i++)
this->element[i]=value[i];
this->len=n;
}
}
template<class T>
Seqlist<T>::~Seqlist()
{
delete[]this->element;
}
template<class T>
bool Seqlist<T>::isEmpty()
{
return len==0;
}
template<class T>
int Seqlist<T>::length()
{
return len;
}
template<class T>
T Seqlist<T>::get(int i)
{
if(i>=0&&i<len)
return element[i];
throw"参数i指定元素无效";
}
template<class T>
bool Seqlist<T>::set(int i,T x)
{
if(i>=0&&i<len)
{
element[i]=x;
return true;
}
return false;
}
template <class T>
ostream& operator<<(ostream& out,Seqlist<T> &list)
{
out<<list.element;
return out;
}
template<class T>
void Seqlist<T>::insert(int i,T x)
{
if(len==size)
{
T*temp=element;
element=new T[size*2];
for(int i=0;i<size;i++)
element[i]=temp[i];
size*=2;
}
if(i<0)
i=0;
if(i>len)
i=len;
for(int j=len-1;j>=i;j--)
element[i+1]=element[i];
element[i]=x;
len++;
}
template<class T>
void Seqlist<T>::insert(T x)
{
insert(len,x);
}
template<class T>
bool Seqlist<T>::remove(int i,T&old)
{
if(len>0&&i>=0&&i<len)
{
old=element[i];
for(int j=i;j<len;j++)
element[i]=element[j+1];
len--;
return true;
}
return false;
}
template<class T>
void Seqlist<T>::clear()
{
len==0;
}
int main()
{
char a[]="abcde";

Seqlist<char> a1(a,6);
cout<<a1;
return 0;
}
改成这样就没问题了,主要有2个问题。
1.定义一般模板友元关系时 应该如下定义
template <class Type>//这里是重点 这句话一定要加 并且与外面的template <class T>不一致
//这是上面提示错误的主要原因
friend ostream& operator<<(ostream& out,Seqlist<Type>& list);
2.这个函数你并没有给出具体定义 我按着大概思路写了一个 具体你自己改
template <class T>
ostream& operator<<(ostream& out,Seqlist<T> &list)
{
out<<list.element;
return out;
}
你的程序还有很多小的问题,根据编译器提示一点一点改就行了。
希望帮到了你!

6. c++, fatal error LNK1120: 1 个无法解析的外部命令

将ShowStr(const string &a)的实现写在main函数前面,同时去掉void ShowStr(const string&a)这个函数申明。

7. 无法解析的外部命令怎么解决

其实只要把外部 lib文件在项目属性里面引入,打开 项目属性->链接器->命令行->附加选项 加入了 .lib 再编译,pass 肯定是引用的库文件的问题,而不是像函数没有定义 检查一下引用的库文件 看看包含这些函数的文件是否加到工程文件中

8. C语言中显示无法解析的外部命令

这是因为c和c++混编带来的问题。

1,问题根源:c++是支持类和名字空间,函数重载等高级技巧的。以函数重载为例:

int Add(int a, int b)

int Add(int a, int b, int c)

这意味着不同的函数有同样的名字(你写的,都叫Add),但是同样的名字会带来混淆,所以使用了一种叫“名字毁坏”的技术,不同的编译器有不同的毁坏规则,只要能实现区分就好。

所以,经过c++编译器的处理,你的Add名字已经面目全非,比如我这里叫:

错误 LNK2019 无法解析的外部符号 "int __fastcall Add(int,int)" (?Add@@YIHHH@Z),函数 _main 中引用了该符号。

到这,都没什么,只不过名字变了一下,只要编译器能处理正确就好。

但是,重点来了,你放了一个c文件进去,c语言,是不支持这些高级玩意儿的,名字也不会毁坏,这样,一个毁坏一个还是原名,得,两下对不上了。

2,解决办法

解决办法也是模式化的,当你声明的变量或者函数在c文件实现的时候,在h文件里声明的时候,用这样的结构包含起来,无论有多少个函数,都可以放在一起。

#ifdef __cplusplus

extern "C" {

#endif

int Add(int, int);

//其他声明

#ifdef __cplusplus

}

#endif

再编译就不会出现Link错误了。

头文件全文如下:

#pragma once

#ifdef __cplusplus

extern "C" {

#endif

int Add(int, int);

#ifdef __cplusplus

}

#endif

9. C语言中显示无法解析的外部命令

前面函数定义的时候,int 后面要带变量名

阅读全文

与无法解析的外部命令相关的资料

热点内容
求知课堂python2020 浏览:260
kafka删除topic命令 浏览:759
phpsql单引号 浏览:86
英雄联盟压缩壁纸 浏览:452
办公app需要什么服务器 浏览:628
安卓服务器怎么获得 浏览:808
空调压缩机冷媒的作用 浏览:781
淘宝app是以什么为利的 浏览:657
java提取图片文字 浏览:924
我的世界手机版指令复制命令 浏览:35
java判断字符串为数字 浏览:926
androidrpc框架 浏览:490
云服务器essd和ssd 浏览:524
家用网关的加密方式 浏览:3
怎么从ppt导出pdf文件 浏览:973
换汽车空调压缩机轴承 浏览:845
平板怎么登录安卓端 浏览:197
图像拼接计算法 浏览:257
怎么打开饥荒服务器的本地文件夹 浏览:293
usb扫描枪编程 浏览:675