Greetings!PyCharm is an IDE I'm quite familiar with, so when (again) starting with C/C it was only natural to take a peek at CLion (nice timing to pushing out the 1.0 btw).But I'm running into tr.
--- Google says: http://www.bloodshed.net/faq.html#3 What the heck is going on here? Does anybody know how to fix this? Wxwidgets doesn't have any main function Regards, Oliver
P: 14
Hi everyone, I'm new to programming with C++ and I'm using Code::Blocks as my compiler. I keep getting the error 'undefined reference to WinMain@16' and I have no idea how to fix it. My code is supposed to do different things with fractions, but anyway here is my code:(all code is in a project) myFracDr.cpp
#include 'frac.h'
#include 'gcd.h'
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout << 'Enter positive integer x: ';
cin >> x;
cout << 'Enter positive integer y: ';
cin >> y;
cout << FractionType::Initialize(x,y) << endl;
system('pause'); //keeps window open
return 0;
}
myFrac.cpp
#include 'frac.h'
#include 'gcd.h'
void FractionType::Initialize(int numerator, int denominator)
// Function: Initialize the fraction
// Pre: None
// Post: numerator is stored in num; denominator is stored in
// denom
{
num = numerator;
denom = denominator;
int cfactor = gcd(num, denom); // finds commom factor
num = num/cfactor; //reduces numerator
denom = denom/cfactor; //reduces denominator
}
int FractionType::NumeratorIs()
// Function: Returns the value of the numerator
// Pre: Fraction has been initialized
// Post: numerator is returned
{
return num;
}
int FractionType::DenominatorIs()
// Function: Returns the value of the denominator
// Pre: Reaction has been initialized
// Post: denominator is returned
{
return denom;
}
bool FractionType::IsZero()
// Function: Determines if fraction is zero
// Pre: Fraction has been initialized
// Post: Returns true if numerator is zero
{
return (num 0);
}
bool FractionType::IsNotProper()
// Function: Determines if fraction is a proper fraction
// Pre: Fraction has been initialized
// Post: Returns true if num is greater than or equal to denom
{
return (num >= denom);
}
int FractionType::ConvertToProper()
// Function: Converts the fraction to a whole number and a
// fractional part
// Pre: Fraction has been initialized, is in reduced form, and
// is not a proper fraction
// Post: Returns num divided by denom
// num is original num % denom; denom is not changed
{
int result;
result = num / denom;
num = num % denom;
return result;
}
gcd.cpp (finds greatest common divisor)
int gcd(int x, int y)
{
if (y0)
{
return x;
}
else
{
while (y>0)
{
int step1 = x%y;
x = y;
y = step1;
if (x%y0)
{
return y;
}
}
}
return 0;
}
then I just have to two header files (frac.h and gcd.h)that I know are correct Thank you for looking!