0

I haven't been coding in some time and I wanted to open up a new project to wipe of the rust.

  • I go to File New... Project
  • I press on "Visual C++"
  • Select an empty project and name it "test"
  • In the solution explorer I right click on Source Files
  • I select Add New Item...
  • I select the C++ file (.cpp) and name it main.cpp (no reason)
  • I write this simple piece of code right here:
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello, world!" << endl;
    return 0;
}

I go to Build Build Solution (and here start the problems...) When it builds it shows this Output:

1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
1>Done building project "Test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It also goes to the Error List and shows this error:LNK1104

I have no idea what's the problem here because this exact same way always worked and now it suddenly doesn't? Can anybody explain me what am I doing here? I searched all over the neat and found people with similar problems but didn't really understand the solutions.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

0

I had similar problem. Try Properties -> Configuration properties -> Linker -> System -> Set the SubSystem to 'Windows (/SUBSYSTEM:WINDOWS)'. It helped to me.

Ruta
  • 1