none
Visual C++ Projects refuses to compile without looking for irrelevant files.

    Question

  • Hi!

    I'm quite new to using SDK's in general.

    I have recently used SDL in a project, and have included files called 'SDL.lib' and 'SDLmain.lib' into my additional dependencies in my environment. 

    However, now, when I try to compile ANY other project, I will get this error:

    [quote]

    1>------ Build started: Project: Test, Configuration: Debug Win32 ------
    1>  SDLmain.lib
    1>c1xx : fatal error C1083: Cannot open source file: 'SDLmain.lib': No such file or directory
    1>  SDL.lib
    1>c1xx : fatal error C1083: Cannot open source file: 'SDL.lib': No such file or directory
    1>  main.cpp
    1>  Generating Code...
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    [/quote]

    Looking through past questions, it appears that the problem is usually caused by files being missing or relocated. My problem is that I don't want 'SDL.lib' or 'SDLmain.lib' in my project as they are completely irrelevant. I have tried to remove them, but to no avail.

    This problem occurs for new projects, old projects, empty projects, even untouched sample projects from other SDK's.

    Here is a link to the detailed build output (CodePaste.net)

    I have tried:

    • Looking thoroughly in project's properties for dependencies and clearing library directories
    • Excluding all files from the project except main.cpp which contains:
    #include <iostream>
    using namespace std;
    
    int main(){
        cout<<"Hello world\n";
        return 0;
    }


    • Resetting environment settings using 

    [quote] Devenv.exe /ResetSettings [/quote]

    • Reinstalling Visual Studio 2010 and anything with 'Visual C++ 2010' in it that can be found under 'Programs and Features'.
    • Deleting the default 'Visual Studio 2010' folder in documents

    I'll be happy to post more information. Any help would be apreciated! :D

    Yujin Wu


    Tuesday, May 22, 2012 8:04 AM

Answers

  • Did you add these settings to Microsoft.Cpp.Win32.user and/or Microsoft.Cpp.x64.user in property manager? Because you see, these are stored somewhere else, and they apply to all projects created on your system.

    With a project that uses the linker, go to Property Manager (if the window isn't shown on the same side as Solution Explorer, go to View->Property Manager or View->Other Windows->Property Manager (depending on your Visual Studio settings) and open it from there). In Property Manager, expand the project and configurations until you find the property sheet, right click on it and then select properties. Go to Common Properties->Linker->Input and check to see if the Additional Dependencies setting is bold. If it is, click on it, near the right of the Property Pages window you should notice a little button with a downward pointing triangle appear. Click on this, in the list that appears, select <inherit from parent or project defaults> and then click apply. Make sure you do this with both user property sheets.

    In future, when you add a library file, always do it in your project properties, since this just affects the project you are currently working on.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

    • Marked as answer by yujinwunz Tuesday, May 22, 2012 9:20 AM
    Tuesday, May 22, 2012 8:47 AM

All replies

  • Did you add these settings to Microsoft.Cpp.Win32.user and/or Microsoft.Cpp.x64.user in property manager? Because you see, these are stored somewhere else, and they apply to all projects created on your system.

    With a project that uses the linker, go to Property Manager (if the window isn't shown on the same side as Solution Explorer, go to View->Property Manager or View->Other Windows->Property Manager (depending on your Visual Studio settings) and open it from there). In Property Manager, expand the project and configurations until you find the property sheet, right click on it and then select properties. Go to Common Properties->Linker->Input and check to see if the Additional Dependencies setting is bold. If it is, click on it, near the right of the Property Pages window you should notice a little button with a downward pointing triangle appear. Click on this, in the list that appears, select <inherit from parent or project defaults> and then click apply. Make sure you do this with both user property sheets.

    In future, when you add a library file, always do it in your project properties, since this just affects the project you are currently working on.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

    • Marked as answer by yujinwunz Tuesday, May 22, 2012 9:20 AM
    Tuesday, May 22, 2012 8:47 AM
  • Thanks.

    Previously, I had mistakenly added 'SDL.lib' and 'SDLmain.lib' to the command line under Common Properties>linker>command line on the Microsoft.Cpp.Win32.user property sheet. By removing them, the problem was fixed.

    Cheers

    Tuesday, May 22, 2012 9:25 AM