Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7850353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:49:14+00:00 2026-06-02T18:49:14+00:00

first time asking. Here’s the deal: I have a helper class (at least now

  • 0

first time asking.

Here’s the deal:

I have a helper class (at least now it’s a class) that has several math functions, that I use throughout the project.

#ifndef CUSTOM_UTILS_H
#define CUSTOM_UTILS_H
//---------------------------------------------------------
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>

class cUtil {
public:
static int utilsRandom(int from, int to);
static double utilsRandom(double from, double to);
static double giveAngle(double x, double y);
static double FoV(double cx, double cy, 
    double fx, double fy, 
    double tx, double ty, 
    double radius);
};
//---------------------------------------------------------
#endif 

Implementation:

#define _USE_MATH_DEFINES
#include "customUtils.h"
//---------------------------------------------------------
int cUtil::utilsRandom(int from, int to) {
if (from == to) {
    return from;
}
return (rand() % (to - from)) + from;
}
//---------------------------------------------------------
double cUtil::utilsRandom(double from, double to) {
  ...
}
//---------------------------------------------------------
double cUtil::giveAngle(double x, double y) {
  ...
}
//---------------------------------------------------------
double cUtil::FoV(double cx, double cy, 
double fx, double fy, 
double tx, double ty, 
double radius) {
  ...
}
//---------------------------------------------------------

(removed the 3 bodies to save space for the post)

Now, when I use it , let’s say, in a class called ‘creature’ I include the customUtils.h file in the header of ‘creature’. And use any of the 4 functions like so: cUtil::func_name().
Sometimes I get an unresolved external error such as

LNK2001: unresolved external symbol "public: static double __cdecl cUtil::utilsRandom
(double,double)" (?utilsRandom@cUtil@@SANNN@Z)  C:\Users\Rockstrongo\Documents\Projects
\nnEvo\nnEvo\net.obj

It appears for all functions in cUtil and for all classes that use those functions.

I said it sometimes appears, because it just does that – I’d be rebuilding the project and it would resurface. To scrub it again I would change some part of cUtils code, or the way it is included in other classes or anything that it would get it running again. For some time, cleaning->compiling the customUtils.cpp->then building the rest worked, but not any more.

To an untrained eye like mine this appears to be completely random and I’m all out off straws to grasp. I’m using Microsoft Visual Studio 2010. It’s a console project using openGL and glut.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:49:16+00:00Added an answer on June 2, 2026 at 6:49 pm

    I see you overloaded cUtil::utilsRandom to use doubles and ints. It’s ok except for one thing: You can not change the returned type. Both overloaded version must either return an int or a double. If you must have different returned types, then do not overload the function. Rather use different function names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's my first time asking here (I have visited the site several times, but
Hi this is the first time I am asking a question here. I have
First time asking a question here. I have a question, I have a UIImageView
It's my first time here asking for your help and knowledge! I have a
this is my first time asking a question here. I tried to be well
first time posting here so be gentle :) On my web pages I have
it's i first time i'm asking here. Sorry if the answer is available already.
For the first time, I am asking a little bit of help over here
This is my first time asking a question, please be gentle! I have a
I am first time asking question here, sorry, but I can not find similar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.