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

  • Home
  • SEARCH
  • 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 8377757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:45:09+00:00 2026-06-09T15:45:09+00:00

I am fairly new to cpp but have been in c# for a while.

  • 0

I am fairly new to cpp but have been in c# for a while. I am trying to run a simple console application but I receive this LNK2001 error message.

I have the main.cpp, and have added another class, Zeus, with files, Zeus.h and Zeus.cpp.

Here is the main.cpp:

#include "Zeus.h"
#include <iostream>

int main()
{
    Zeus::tick = 25.0;
    using std::cout;
    cout << "nothing";
}

Here is the Zeus.h:

static class Zeus
{
public:
    static void testing(void);
public:
    static double tick;
};

And here is the Zeus.cpp:

void Zeus::testing(void)
{
 //Doesnt get this far
 //But eventually something like
 // cout << "test " << Zeus::tick;

}

And here is the error message:

Error 20 error LNK2001: unresolved external symbol “public: static double Zeus::tick”

Thanks,

  • 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-09T15:45:10+00:00Added an answer on June 9, 2026 at 3:45 pm

    You need to define Zeus::tick, typically you would to that in the in the Zeus.cpp file. You have only declared it.

    double Zeus::tick = 0.0;
    

    Also, there is no static class in C++.

    As an aside, free functions can be put in namespaces, as opposed to being static functions of classes. This is the preferred way in C++, unless there are strong reasons for the function to be static.

    namespace Dionysus {
      void testing();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Fairly new to Jquery here.... but one thing I have been told and being
I'm fairly new to programming in general but have been working with Java for
I am fairly new to php and mysql but I have created a small
I'm fairly new to C++ standard library and have been using standard library lists
I'm fairly new to c++ and compiling, however I have done this in the
Fairly new to socket programming, but I've been assigned with a whopper of project.
im fairly new to android development, but i'm having some trouble trying to make
Fairly new to jquery so I might be making a simple mistake but I
Im fairly new to c sorry if this is a stupid question! i have
Fairly new to asp.net Mvc and jquery. Have the following code working fine, but

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.