-1

my code looks like this:

//Renderer.h file
#pragma once

class Renderer {
public:
static int Test();
};
//Renderer.cpp file
#include "../Header/Renderer.h"
#include <iostream>

int Renderer::Test() {
    std::cout << "This is a test" << std::endl;
    return 1
}

//main.cpp file
#include "Renderer/Header/Renderer.h"
int main()
{
    Renderer::Test();
}

Whenever I try to run this code, I get an unresolved external symbol error. I tried creating a different file with a dummy class, had the same exact code and this one worked just fine without any errors.

I really don't get what I did wrong.

1 Answer 1

0

Ok, so I made a new header and cpp file and copied the respecting content from Renderer.h and Renderer.cpp over to the new files, deleted the original files and renamed the new files to the same as the old files, and now it works. The issue seemed to be with visual studio.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.