C++ error types

Hello all, Will keep updating this page whenever i come across some error, i am not going to distinguish between big or small.(I have just started so better to gather info!!)

Wrong

#include<iostreams>

fatal error C1083: Cannot open include file: 'iostreams': No such file or directory

Correct

#include<iostream>

____________________________________________

Wrong

using namespace std; // If not declared

cout << “hello world” << endl;

error C2065: 'cout': undeclared identifier

Correct

std::cout << “Hello world” << std::endl;

____________________________________________

Wrong

int mains() or int trial()

1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
: fatal error LNK1120: 1 unresolved externals
 -- FAILED.

Correct

int main()

____________________________________________

Wrong

#include<iostream>
#include<string>


struct Player {
	std::string name;
	int hp;
};

Player me; //create an instance of player
me.name = "Tom";
me.hp = 100;

int main() {
	std::cout << me.name << me.hp << std::endl;
}
1>------ Build started: Project: MySecondProj_book, Configuration: Debug Win32 ------
1>Source.cpp
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(11): error C3927: '->': trailing return type is not allowed after a non-function declarator
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(11): error C3484: syntax error: expected '->' before the return type
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(11): error C3613: missing return type after '->' ('int' assumed)
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(11): error C2371: 'me': redefinition; different basic types
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(9): note: see declaration of 'me'
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(11): error C2146: syntax error: missing ';' before identifier 'name'
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(12): error C3927: '->': trailing return type is not allowed after a non-function declarator
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(12): error C3484: syntax error: expected '->' before the return type
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(12): error C3613: missing return type after '->' ('int' assumed)
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(12): error C2371: 'me': redefinition; different basic types
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(9): note: see declaration of 'me'
1>d:\all_projs\c++_proj\mysecondproj_book\mysecondproj_book\source.cpp(12): error C2146: syntax error: missing ';' before identifier 'hp'
1>Done building project "MySecondProj_book.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Correct

#include<iostream>// import input output stream
#include<string>

struct Player {
	std::string name;
	int hp;
};

Player me; //create an instance of player

int main() {	
	me.name = "Tom";
	me.hp = 100;
	std::cout << me.name << me.hp << std::endl;
}
____________________________________________ 

OpenGL errors

Wrong

https://www.glfw.org/documentation.html (code used from the link)

1>------ Build started: Project: Project2, Configuration: Debug x64 ------
1>Source.cpp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Source.obj : error LNK2019: unresolved external symbol __imp_glClear referenced in function main
1>D:\All_Projs\c++_Proj\Project2\x64\Debug\Project2.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "Project2.vcxproj" -- FAILED.

Correct

Add the “opengl32.lib” in the properties and rebuild it should fix the issue.

https://stackoverflow.com/questions/20223198/visual-studio-11-glfw-external-symbol-error

____________________________________________

Wrong

Error: The code execution cannot proceed because glew32.dll was not found.

Fix: https://stackoverflow.com/questions/22306260/how-can-i-solve-glew32-dll-is-missing-from-your-computer-issue-of-my-opengl-pr search for “Haha TTpro”

Copying the glew32.dll file in the /project/x64/glew32.dll fixes the issue, worked for me.