Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 未定义对类的引用::函数错误_C++_Compiler Errors - Fatal编程技术网

C++ 未定义对类的引用::函数错误

C++ 未定义对类的引用::函数错误,c++,compiler-errors,C++,Compiler Errors,我迷路了,没有我知道的东西可以尝试。我试图在main中调用一个函数,但不断得到一个未定义的引用错误未定义对“ParkingController::parkingMenuControl”的引用 我如何解决这个问题?我尝试过重命名对该类的调用,甚至尝试过重命名该类,但没有成功。下面是我的代码。事先谢谢你的帮助 帕金康托酒店 #ifndef PARKINGCONTROL_H_INCLUDED #define PARKINGCONTROL_H_INCLUDED #include <iostream

我迷路了,没有我知道的东西可以尝试。我试图在main中调用一个函数,但不断得到一个未定义的引用错误未定义对“ParkingController::parkingMenuControl”的引用

我如何解决这个问题?我尝试过重命名对该类的调用,甚至尝试过重命名该类,但没有成功。下面是我的代码。事先谢谢你的帮助

帕金康托酒店

#ifndef PARKINGCONTROL_H_INCLUDED
#define PARKINGCONTROL_H_INCLUDED
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>

using namespace std;

class ParkingController
{
 public:
  void parkingMenuControl();
  int parkingOption;

private:
};

#endif

你能发布你用来编译的命令吗?我强烈怀疑你的问题是,也许几百个其他的,如果你在这个站点上寻找C++的未定义的引用。@ CTCTO我在编译代码块里面编译。@ MPONITE CODEBLUK会在构建过程中发出输出日志窗口中的编译和链接线。我只是在本地构建了你的代码。根本没有得到任何错误:clang++main.cpp parkingControl.cpp
#include "parkingControl.h"
using namespace std;
ParkingController parkingMenuMain;
int main(){
cout << "Welcome, Would you like to view our menu for parking?"<< endl;
cout << "Enter 1 to view menu or 0 to leave." << endl;
cin>>parkingMenuMain.parkingOption;

if (parkingMenuMain.parkingOption == 0)
  {
    exit(-1);
  }
else if (parkingMenuMain.parkingOption == 1)
  {
    parkingMenuMain.parkingMenuControl();
  }
}
#include "parkingControl.h"

/*
This module sets up the menu for the parking controller.
In here one can view the drawer with the money stored in
it and select a parking gate to enter from.
*/
using namespace std;
ParkingController parkingControlMenu;

void ParkingController::parkingMenuControl()
{
//Doing some function
}