導航:首頁 > 程序命令 > 無法解析的外部命令

無法解析的外部命令

發布時間: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 後面要帶變數名

閱讀全文

與無法解析的外部命令相關的資料

熱點內容
編程拖放 瀏覽:40
linux卸載tomcat 瀏覽:875
手機時間如何校正到伺服器 瀏覽:81
創造與魔法瞬移源碼百度 瀏覽:882
反射優化java 瀏覽:874
硬體加密播放盒子 瀏覽:923
xp點擊文件夾選項沒反應 瀏覽:537
蘋果不顯示桌面的app怎麼刪除 瀏覽:864
安卓手機怎麼換國際服 瀏覽:415
神獸領域安卓怎麼下載 瀏覽:250
單片機交通燈ad原理圖 瀏覽:413
多功能解壓磁鐵筆 瀏覽:80
少兒編程火箭升空 瀏覽:401
蘭斯10游戲解壓碼 瀏覽:42
手機proxy伺服器地址 瀏覽:449
吉他清音壓縮 瀏覽:301
簡歷模板程序員 瀏覽:882
螺桿壓縮機虛標型號 瀏覽:953
idea開發項目伺服器ip地址 瀏覽:125
串口伺服器出現亂碼怎麼解決 瀏覽:950