错误LNK2019:未解析的外部符号
【腾讯云】亏本大甩卖,服务器4核16G 1年370元(带宽12M,系统盘120GB SSD盘,月流量2000GB)!!!!!!
云产品 配置 价格
服务器 1核2G,带宽5M,系统盘50GB SSD盘,月流量500GB 38元/年
MySQL 1核1G 19元/年
服务器 16核32G,带宽18M,系统盘250GB SSD盘,月流量5000GB 1197元/年
点我进入腾讯云,查看更多详情

Ok, so I'm having a problem trying figure out the problem in my code. I have a lot of code so I'm only going to post the relevant parts that are messing up when I compile. I have the following function inside of a class and it will compile and everything will run fine until I call the function "CalculateProbabilityResults" and it runs the 7th line of code within it. I've "de-commented" this line of code in my program so you can find it easier. I'm pretty sure I have the right #include directives needed since it compiles fine when not calling the function, so that can't be the problem can it? I know some of my naming notation needs a little help, so please bear with me. Thanks in advance for the help guys.

int SQLServer::CalculateProbabilityResults(int profile, int frame, int time_period, int TimeWindowSize) {
    ofstream ResultFile;
    stringstream searchFileName;
    stringstream outputName;
    vector<vector<int>> timeFrameItemsets;
    int num = getTimeFrameFile(frame*TimeWindowSize, TimeWindowSize);
    cout << num << endl;

    //outputName << "Results" << getTimeFrameFile((frame*TimeWindowSize), TimeWindowSize) << ".csv";
    cout << outputName.str() << endl;
    outputName.clear();
    //ResultFile.open(outputName.str().c_str());
    ResultFile.close();
    result.resize(0);
    return 0;
}

int getTimeFrameFile(int timeInHours, int timeFrameSize) {
    int fileNum = 0;
    int testWin;
    if (timeInHours > 24) {
        while (timeInHours >24)
            timeInHours -= 24;
    }
    for (testWin = 0; testWin < 24/timeFrameSize; testWin++) {
        if (timeInHours >= testWin*timeFrameSize && timeInHours < (testWin+1)*timeFrameSize)
            fileNum = testWin+1;
    }
    if (fileNum == 0)
        fileNum = testWin+1;
    return fileNum;
}

Call Log

1>------ Rebuild All started: Project: MobileSPADE_1.3, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'MobileSPADE_1.3', configuration 'Debug|Win32'
1>Compiling...
1>main.cpp
1>MobileSPADE.cpp
1>SQLServer.cpp
1>Generating Code...
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>Linking...
1>LINK : C:\Users\JoshBradley\Desktop\MobileSPADE_1.3\MobileSPADE_1.3\Debug\MobileSPADE_1.3.exe not found or not built by the last incremental link; performing full link
1>SQLServer.obj : error LNK2019: unresolved external symbol "public: int __thiscall SQLServer::getTimeFrameFile(int,int)" (?getTimeFrameFile@SQLServer@@QAEHHH@Z) referenced in function "public: int __thiscall SQLServer::CalculateProbabilityResults(int,int,int,int)" (?CalculateProbabilityResults@SQLServer@@QAEHHHHH@Z)
1>C:\Users\JoshBradley\Desktop\MobileSPADE_1.3\MobileSPADE_1.3\Debug\MobileSPADE_1.3.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\JoshBradley\Desktop\MobileSPADE_1.3\MobileSPADE_1.3\MobileSPADE_1.3\Debug\BuildLog.htm"
1>MobileSPADE_1.3 - 2 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

#0

The compiler thinks that getTimeFrameFile is a SQLServer method:

unresolved external symbol "public: int __thiscall SQLServer::getTimeFrameFile(int,int)"

but you have it defined as a free function:

int getTimeFrameFile(int timeInHours, int timeFrameSize) {

Change that from a free function to a class method will solve the problem:

int SQLServer::getTimeFrameFile(int timeInHours, int timeFrameSize)

#1

Put the function getTimeFrameFile above SQLServer::CalculateProbabilityResults.

推荐文章

在Flex中以编程方式加载图像

在Flex中以编程方式加载图像

推荐文章

我是否可以创建一个包含多个区域的ASP.NET MVC 2项目,而不引用父区域中的每个子区域?

我是否可以创建一个包含多个区域的ASP.NET MVC 2项目,而不引用父区域中的每个子区域?

推荐文章

在支持移动设备的同时,是否有任何关于网络视频的既定标准实践?

在支持移动设备的同时,是否有任何关于网络视频的既定标准实践?

推荐文章

绑定gridview问题;取消绑定时的jquery解析?

绑定gridview问题;取消绑定时的jquery解析?

推荐文章

如何用backgroundworker更新GUI?

如何用backgroundworker更新GUI?

推荐文章

应用程序测试设置中的设置失败

应用程序测试设置中的设置失败

推荐文章

不断的虐待?

不断的虐待?

推荐文章

使用实时弹出菜单最小化Delphi应用程序

使用实时弹出菜单最小化Delphi应用程序

推荐文章

vb中“:”的定义是什么

vb中“:”的定义是什么

推荐文章

多线程难题

多线程难题

推荐文章

为什么MyModel.all.each{m}m.destroy}不能按预期工作?

为什么MyModel.all.each{m}m.destroy}不能按预期工作?

推荐文章

具有多个零值问题的标志枚举(TextFormatFlags)

具有多个零值问题的标志枚举(TextFormatFlags)

推荐文章

多视图(屏幕)管理?

多视图(屏幕)管理?

推荐文章

动态生成组合框名称

动态生成组合框名称

推荐文章

观察者设计模式

观察者设计模式

推荐文章

Xcode中的链接

Xcode中的链接