Getting lnk1120 error message

I have been trying to compile a c++ program. I keep getting an error message lnk1120 1 unresolved external.

I create a header file, an implementation file and a main program file. Here is my code

Header file contains

#ifndef _W_H
#define _W_H

Class juu {

Private:

Public:

massu();

};

#endif

Implementation file contains

#include "w.h"
#include<iostream>
using namespace std;

void juu::massu() {

cout << "hello jack\n";
cout << "hello matt\n";
cout << "hello fred\n";
}

main program file contains

#include "w.h"
#include<iostream>
using namespace std;

void main() {

juu huu;

Huu.massu();

}
Please use code tags when posting code.
https://www.cplusplus.com/articles/jEywvCM9/

> I keep getting an error message lnk1120 1 unresolved external.
Post the actual text, what symbol is it looking for.

> void main()
main returns int.
https://en.cppreference.com/w/cpp/language/main_function
pay attention to the use of the word "shall".

> Class juu {
> Private:
> Public:
C++ is case sensitive.
Assuming that your code actually compiled, posting code with random capitalisation isn't going to help ANYONE figure out your problem.


In c++ lowercase and uppercase are distinct.

Please use code tags.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>
using namespace std;

class juu {         // <======== class, not Class
private:            // <======== private, not Private
public:             // <======== public, not Public
   void massu();    // <======== needs void
};


void juu::massu() {
   cout << "hello jack\n";
   cout << "hello matt\n";
   cout << "hello fred\n";
}

int main() {        // <======== int main, not void main
   juu huu;
   huu.massu();     // <======== huu, not Huu
}
I don't think I used lower case letters. My cell phone automatically capitalizes the first letter. I forgot to write it as a lower case letter. The code does not contain upper case letters. How do I fix this?
Jack6789 wrote:
The code does not contain upper case letters.


You could have fooled me!

1
2
3
4
5
Class juu {

Private:

Public:

I mean the code I wrote on my computer does not contain capital letters, not the code I posted on this forum. How do I fix this?
Are you programming on a cell phone? Copy and paste the code from your desktop, exactly as it is.

Aside from what was already said (capitalization, void main), I don't see any glaring issues with the code. It's possible you aren't compiling (or linking) what I assume is your "w.cpp" file? Your compiler should tell you exactly which symbol is not being resolved; show the full error message.
Last edited on
> My cell phone automatically capitalizes the first letter. I forgot to write it as a lower case letter.
Wait until you get home and you can copy/paste directly from your source code.

Just pasting your half-assed remembered code with random typos is just a waste of EVERYONES time.

Topic archived. No new replies allowed.