LNK1104: cannot open file 'libraryName.lib' file

46 Views Asked by At

error messageThis is my first time using Visual Studio. My plan is to build some simple software with no external libraries & dependencies, and use CMake to turn it in an executable. However, I was hit with an LNK1104 error. The following contains two cpp files & an hpp file.

main.cpp

#include "sum_driver.hpp"


int
main
()
{

        sum_driver      the_driver;
        the_driver.go();
   

}

sum_driver.hpp

#ifndef sum_driver_HPP
#define sum_driver_HPP


using namespace std;

class sum_driver
{
  // Class methods
public:

  // Constructor
  sum_driver(void);

  // Destructor
  ~sum_driver(void);

  void go();
  


  // Attributes
protected:


    int numberGuesser;
};

#endif sum_driver_HPP

sum_driver.cpp:

#include "sum_driver.hpp"
#include <stdio.h> 
#include<stdlib.h>
#include<time.h>

sum_driver::
sum_driver
(void)
{
  char * default_error_name = "sum.err";
 
  {
 
  }


}

sum_driver::
~sum_driver
(void)
{
 
    
}

void
sum_driver::
go
()
{
    int guessingNum = rand() % 100; //number from 1 - 100
    int noOfTimes = 0;
    int numberGuesser = 0;

    printf("Guess a number from 1 - 100 to find out what the number is.");

    while (guessingNum != numberGuesser) {
        scanf("%d", &numberGuesser);

        if (numberGuesser > guessingNum) { //if greater
            printf("%d is greater than the actual number. Guess again!", numberGuesser);
            noOfTimes++;
        }
        if (numberGuesser < guessingNum) { //if less
            printf("%d is less than the actual number. Guess again!", numberGuesser);
            noOfTimes++;
        }
    }

    printf("Congratulations! You guessed it correctly! It took you %d tries! Press escape to leave.", noOfTimes);

}

I've tried getting rid of all input linkers through Project -> Properties -> Linkers -> Input, but that didn't work either. Please note that I want 0 external libraries & dependencies. In other words, I do not want to add them to prevent this error.

EDIT: So I added 'string_util_x64_mtd.lib' because it's a standard C library that's mandatory, but it's still giving me the same error (Input Linker/s Here

0

There are 0 best solutions below