- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在帮助一位 friend 学习 C++,但老实说,我们需要很大的帮助。
为什么我们总是得到这个错误:“MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external符号 main 在函数 __tmainCRTStartup 中引用”
代码如下:
//Maria Delgado (1013725) - Coursework 2 - Program Conducting timber component structural design
#include<iostream>
#include<iomanip>
#include<cmath>
#include<fstream>
#include<string>
using namespace std;
//Variables for Strength Properties in (N/mm2)
//fmk=Bending
//fc90k=Compression Perpendicular
//fvk=Shear
//Calculating Member Size Factor:
void memberSizeFactor(double chosenDepth)
{
if (chosenDepth<150)
kH=pow(150/chosenDepth,0.2);
else
cout<<"Please input a depth less than 150mm"<<endl;
}
//Error message for all negative values entered
double errorNeg()
{
float value=-1;
while (value<0)
{
cout<<"You have entered a negative value. This variable cannot take negative values. Please input positive values!";
cin>>value;
cout<<endl;
}
return value;
}
//Beam Member Class
class beamMember
{
private:
double chosenLength;
double chosenWidth;
double chosenDepth;
double chosenBearingLength;
double serviceClassAbility;
string strengthClass;
public:
beamMember()
{
chosenLength=chosenWidth=chosenDepth=chosenBearingLength=serviceClassAbility=0;
strengthClass="";
}
void beamDimensionsData()
{
cout<<"The following dimensions need to be input into the program:"<<endl;
cout<<"What is the desired beam LENGTH in millimeters?";
cin>>chosenLength;
if(chosenLength<0) chosenLength=errorNeg();
cout<<"What is the desired beam WIDTH in millimeters?";
cin>>chosenWidth;
if(chosenWidth<0) chosenWidth=errorNeg();
cout<<"What is the desired beam DEPTH in millimeters?";
cin>>chosenDepth;
if(chosenDepth<0) chosenDepth=errorNeg();
cout<<"What is the desired beam BEARING LENGTH in millimeters?";
cin>>chosenBearingLength;
if(chosenBearingLength<0) chosenBearingLength = errorNeg();
cout<<"Please insert a strength class of timber e.g.C12 to C50:";
cin>>strengthClass;
cout<<endl<<"Please choose a service class ability for member i.e. 1 or 2 or 3:";
cin>>serviceClassAbility;
cout<<endl;
}
//***************************CALCULATE OVERALL DESIGN LOAD************************************************************
double load(beamMember designBeam)
{
cout<<"Under these circumstances, the beam will be adequate to support a slab."<<endl<<endl;
double qK;
double gK;
double span;
cout<<"Please input the total live load in kN/m2:";
cin>>qK;
cout<<endl;
if (qK<0) qK=errorNeg();
qK=qK*gammaQ;
cout<<"Please input the total dead load in kN/m2:";
cin>>gK;
if (gK<0) gK=errorNeg();
gK=gK*gammaG;
cout<<"Enter the span between the beams in millimeters:";
cin>>span;
while(span<0) span=errorNeg();
cout<<endl;
span=span*(qK+gK)*chosenLength/10e2;
cout<<"Point load:"<<span<<"N"<<endl<<endl;
return span;
}
//***********************************CHECKING BENDING STRESS*********************************************************
void checkBendingStress(beamMember designBeam, double force)
{
cout<<"Bending Stress Check:"<<endl;
double bendingMoment;
double secondMomentofArea;
double designBendingStress;
double actualBendingStress;
bendingMoment=force*chosenLength/8;
cout<<"Maximum bending moment is "<<bendingMoment<<"Nmm"<<endl;
secondMomentofArea=chosenWidth*pow(chosenDepth,3)/12;
designBendingStress=kH*kSYS*kMOD*matrix[0]/gammaM;
actualBendingStress=(bendingMoment*chosenDepth/2)/secondMomentofArea;
cout<<"Maximum permissibile stress:"<<designBendingStress<<"N/mm2"<<endl;
cout<<"The actual stress that the beam is subject to:"<<actualBendingStress<<"N/mm2"<<endl;
if(actualBendingStress<=designBendingStress)
cout<<"Beam bending stress check successful!"<<endl<<endl;
else
cout<<"Beam bending stress check unnsuccessful!"<<endl<<endl;
}
//***********************************CHECKING SHEAR STRESS*********************************************************
void checkShearStress(beamMember designBeam, double force)
{
cout<<"Shear Stress Check:"<<endl;
double designShearingStress;
double actualShearingStress;
designShearingStress=matrix[5]*kMOD*kSYS/gammaM;
actualShearingStress=(1.5*force/2)/(chosenWidth)/(chosenDepth);
cout<<"Maximum permissible shear stress:"<<designShearingStress<<"N/mm2"<<endl;
cout<<"Shear stress that the supports are subjected to:"<<actualShearingStress<<"N/mm2"<<endl;
if(actualShearingStress<=designShearingStress)
cout<<"Beam shear stress check successful!"<<endl<<endl;
else
cout<<"Beam shear stress check unsucessful!"<<endl<<endl;
}
//********************************CHECKING BEARING STRESS***********************************************************
void checkBearingStress(beamMember designBeam, double force)
{
double kc90;
double designBearingStress;
double actualBearingStress;
actualBearingStress=force/2/chosenWidth/chosenBearingLength;
cout<<"Bearing Stress that the beam is subjected to:"<<actualBearingStress<<"N/mm2"<<endl;
designBearingStress=matrix[4]*kMOD*kSYS/gammaM;
cout<<"Maximum permissible bearing stress:"<<designBearingStress<<"N/mm2"<<endl;
kc90=(2.38-chosenBearingLength/250)*(1+chosenDepth/12/chosenBearingLength);
cout<<"Constant, kc90 is "<<kc90<<endl;
cout<<"Factored design bearing stress is "<<kc90*designBearingStress<<endl;
if (actualBearingStress<=designBearingStress)
cout<<"Beam bearing stress check successful!"<<endl<<endl;
else
cout<<"Beam bearing stress check unsuccessful!"<<endl<<endl;
}
//********************************CHECKING LATERAL TORSIONAL STABILITY**************************************************
void checkLateralTorsionalStability(beamMember designBeam, double force)
{
cout<<"Lateral Torsional Stability Check:"<<endl;
double bendingMoment;
double secondMomentofArea;
double designBendingStress;
double actualBendingStress;
bendingMoment=force*chosenLength/8;
cout<<"Maximum bending moment is "<<bendingMoment<<"Nmm"<<endl;
secondMomentofArea=chosenWidth*pow(chosenDepth,3)/12;
designBendingStress=kH*kSYS*kMOD*matrix[0]/gammaM;
actualBendingStress=(bendingMoment*chosenDepth/2)/secondMomentofArea;
cout<<"Maximum permissibile stress:"<<designBendingStress<<"N/mm2"<<endl;
cout<<"The actual stress that the beam is subject to:"<<actualBendingStress<<"N/mm2"<<endl;
if(actualBendingStress<=designBendingStress)
cout<<"Beam Lateral Torsional Stability check successful!"<<endl<<endl;
else
cout<<"Beam Lateral Tosional Stability check unnsuccessful!"<<endl<<endl;
}
//*************************************FUNCTION FOR STRENGTH CLASS DATA FILE**********************************************
void strengthClassData(string classStrength, double serviceClass)
{
string data;
ifstream file;
file.open("strengthclassdata.txt");
file>>data;
while(file&&data!=classStrength)
{
file>>data;
}
for(int i=0;i<=5;i++)
file>>matrix[i];
file.close();
}
//Welcome Message for Program
void welcome()
{
cout<<"The following is Yadhuvamshi Rajamani's program"<<endl
<<"that conducts timber component structural design"<<endl
<<"according to EC5. Specifically, it is a limit state"<<endl
<<"design program that compares design actions with design strengths."<<endl;
}
//******************************BEAM START UP*****************************************************************************
void beamStartUp()
{
beamMember designBeam;
double force;
designBeam.beamDimensionsData();
force=load(designBeam);
checkBendingStress(designBeam,force);
checkShearStress(designBeam,force);
checkBearingStress(designBeam,force);
checkLateralTorsionalStability(designBeam,force);
}
int main()
{
welcome();
char startKey;
cout<<"Please select 1 to start the beam test program or 2 to exit the program, followed by enter!";
cin>>startKey;
cout<<endl;
while(startKey!='2')
{
switch(startKey)
{
case '2':
return 1;
case '1':
beamStartUp();
break;
}
cout<<"Please select 1 to start the beam test program or 2 to exit the program, followed by enter!";
cin>>startKey;
cout<<endl;
}
return 1;
}
};
`
最佳答案
int main()
函数需要在您的类定义之外。您需要创建一个类实例并使用它来调用 welcome 和 beamStartUp 函数。
关于c++ - 如何摆脱这个错误 : "MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8528863/
节点版本:v6.11.0 错误信息: Unable to resolve path to module './coins.json'. (import/no-unresolved) 我还附上错误的屏幕
我的 flutter 应用程序运行良好,直到我停止成功构建的日子 android/app/src/main/kotlin/com/apps/myapp/MainActivity.kt 文件 packa
我在使用 kotlin 版本 1.3.41 的 kotlin 项目中遇到问题 Unresolved reference :我无法找出为什么会出现该问题?。我也降级了 kotlin 版本但没有效果。 当
在编译我的代码时,我收到此错误。 1>MSVCRTD.lib(crtexe.obj):错误 LNK2019:函数 ___tmainCRTStartup 中引用了未解析的外部符号 _main1>C:\U
我一直遇到这两个错误,但我似乎找不到有效的解决方案。 LNK1120: 1 unresolved externals Error 1 error LNK2019: unresolved externa
我想使用 SQLite,但出现 Unresolved -* 错误。以下是我所做工作的总结: 这是三个目录: 源文件 -->include -->src -->sqlite3 我已将以上三个目录全部添加
我在尝试构建时收到以下错误: 1> MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 r
我在构建程序时不断收到“未解析的外部符号”错误。但是,该程序编译正常。我正在使用 GLFW 和 GLAD 库。 #include #include #include void framebuff
我是谷歌测试框架的新手。这是我的第一个谷歌测试测试项目。我做了像这个网站http://www.bogotobogo.com/cplusplus/google_unit_test_gtest.php这样
当我尝试编译我的代码时,我遇到了两个错误。我已经定义了 win32 控制台应用程序。我什至还没有开始编码。我的配置如下 - 链接器 - 子系统 - 控制台;链接器 - 高级 - 入口点 - 空白。
我尝试构建我的应用程序,但失败了,仅显示一条消息: Failed to resolve: play-services-basement 我的应用程序昨天成功构建。自昨天成功构建以来,没有代码更改。我的
任务是找到所有可表示为两个自然数的开方之和的二值数。我试试这个: func = [sqrt (x) + sqrt (y) | x a -> a mod :: Integral a => a -> a
Kotlin: Unresolved reference: totalFee 我只是在做这个小虚拟程序来练习,但它说totalFee尝试将值打印到屏幕时未解决。我已经看了一段时间了,不知道为什么。da
我正在编写一个小程序来判断字符串数组向前和向后读取是否相同。现在我的程序应该返回 false。我遇到了一些困难,因为当我扫描数组时,我希望第二个 for 循环扫描第一个 for 循环所在的相同索引,但
请问有人可以针对我的问题发布错误更正并经过测试的代码吗?程序确实 - 22.php 具有以下形式。当用户输入并单击“提交”按钮时,结果应从 23.php 中获取并显示在 22.php 上的 div 中
当我编译它时给出错误信息: usimage.cpp Generating Code... Linking... Creating library .\Output/gci2.lib and ob
我有以下项目文件: //connections.cpp #include "stdafx.h" #include "LibraryHeaders.h" #include "FileManager.h"
我正在写一个游戏,但我遇到了一个问题,导致“C++ Unresolved external 问题” ** 我的类(class):** Terrain.h Class Terrain {}; 物理对象.
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
我正在使用 Visual Studio 2012 完成编程原则和实践中的练习。尝试编译下面的源代码时,我遇到了链接器错误: unresolved symbol int foo. 我不明白为什么符号没有
我是一名优秀的程序员,十分优秀!