How to handle the Specification and Implementation files to be used in C++?

  • C/C++
  • Thread starter yungman
  • Start date
  • Tags
    files
In summary: Rectangle r = Rectangle:: Rectangle(); cout << r.getW() << endl;cout << r.getL() << endl;cout << r.getA() << endl;
  • #71
If you have spaces in the path then you need to put quotes around it I think "c:\...". You can use the browser to select the folder if you hit the down arrow, and then the file icon.

Nothing will be indicated and no files will be added to the project. But the red squiggly under your #include "someheaderfileinrandomfolder.h" will go away and your problem that the compiler didn't know where to look for your header files will be solved and your program will compile fine.

IMPORTANT: also, the configuration selected in the upper left corner needs to be set to "All Configurations" if you want it to apply to both "Debug" and "Release" modes.
 
Last edited:
  • Like
Likes yungman
Technology news on Phys.org
  • #72
Jarvis323 said:
If you have spaces it might be a problem. You can use the browser to select the folder if you hit the down arrow, and then the file icon.

Nothing will be indicated and no files will be added to the project. But the red squiggly under your include will go away and your program will compile fine.
I think I got it:

I click Edit, this is the menu that show up:
Edit manual.jpg


Then I hit the file icon and search the path and OK.
Add directory.jpg


But I still don't see anything added in the Solution Explorer. Looks the same as before I added it.

Thanks
 
  • #73
yungman said:
I think I got it:

I click Edit, this is the menu that show up:
View attachment 270501

Then I hit the file icon and search the path and OK.
View attachment 270502

But I still don't see anything added in the Solution Explorer. Looks the same as before I added it.

Thanks
It shouldn't look any different. But now your project will compile successfully. Also if you open the vcxproj file in notepad you will see a line that it generated.
 
  • Like
Likes yungman
  • #74
yungman said:
I tried that, this is what I got:
Nothing like you described.

Thanks
Is this from a project that doesn't build?
This is what Temp.vcxproj looks like for my working program. Down toward the bottom is where the source files and header files are listed.
XML:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <VCProjectVersion>15.0</VCProjectVersion>
    <ProjectGuid>{65181934-D7D5-42C1-9FA7-E8A4CB3EF064}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>Temp</RootNamespace>
    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClInclude Include="Rectangle.h" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="Rectangle.cpp" />
    <ClCompile Include="RectImpl.cpp" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>
 
  • #75
Jarvis323 said:
It shouldn't look any different. But now your project will compile successfully. Also if you open the vcxproj file in notepad you will see a line that it generated.
THANKS A MILLION

How do you know that! You said you don't even use VS!

Yes, that works. I did it on the Temp file and I runs!

Ha ha, I mess up something, some how, I closed the Solution Explorer and I can't get back my normal stuffs on the right. But that's a different problem I created myself.

I can sleep better now.

Thanks I really appreciate your help. This resolve my very problem. Now I know I have to go to include external files.
 
  • #76
Mark44 said:
Is this from a project that doesn't build?
This is what Temp.vcxproj looks like for my working program. Down toward the bottom is where the source files and header files are listed.
XML:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <VCProjectVersion>15.0</VCProjectVersion>
    <ProjectGuid>{65181934-D7D5-42C1-9FA7-E8A4CB3EF064}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>Temp</RootNamespace>
    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClInclude Include="Rectangle.h" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="Rectangle.cpp" />
    <ClCompile Include="RectImpl.cpp" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>
It is not like this, there only very little stuffs in it. I linked the txt file in post#68. It looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>
Anyway, I had itchy fingers, somehow I closed the Solution explorer, how can I open it back. VS has memory, I screwed up in one file, I closed it. I open another project, my screw up pass on to the next project! Now I don't have Solution Explorer in other projects. Is there a quick way to go back to default? I am having a hard time with VS, more so than C++!

Thanks
 
  • #77
yungman said:
It is not like this, there only very little stuffs in it. I linked the txt file in post#68. It looks like this:
Yes, I saw the file you had attached. If that was the whole thing, then it's no wonder the program wouldn't build. Best thing to do is to save the three files (the two .cpp files and the header file) somewhere, close VS, and from Windows Explorer, delete the directories.
Then start from scratch with a new project. If you have deleted the Temp directory and everything under it (after saving the three files I mentioned), you can
create a new empty project (you can call it Temp or whatever),
In VS, Add --> New items in the Source Files directory.
In VS, Add --> New items in the Include Files directory.
Copy each of the saved files into the source file and header file place-holders
Build.
yungman said:
Anyway, I had itchy fingers, somehow I closed the Solution explorer, how can I open it back.
View menu --> Solution Explorer
 
  • Like
Likes yungman
  • #78
Mark44 said:
Yes, I saw the file you had attached. If that was the whole thing, then it's no wonder the program wouldn't build. Best thing to do is to save the three files (the two .cpp files and the header file) somewhere, close VS, and from Windows Explorer, delete the directories.
Then start from scratch with a new project. If you have deleted the Temp directory and everything under it (after saving the three files I mentioned), you can
create a new empty project (you can call it Temp or whatever),
In VS, Add --> New items in the Source Files directory.
In VS, Add --> New items in the Include Files directory.
Copy each of the saved files into the source file and header file place-holders
Build.
View menu --> Solution Explorer
Thanks for the reply, I got back my Solution Explorer

No, it's from a working project. They all are this short. To confirm I am opening the right one, this is the one I open, this is a working project:
vcxproj.jpg


thanks for all the help.
 
  • #79
I still cannot get back to the original Solution Explorer like this that show Header file and Source file:
Solution Explorer.jpg

The solution Explorer that I got back using View-->Solution Explorer has less and not include like above as shown below. It's missing the two:
Solution Explorer short.jpg


I tried ADD --> Folder and just put back Header file and Source File? I did Add-->Existing on both Temp.cpp and Temp.h into the corresponding folder and ran. It works. Is that the right way?

Thanks
 
Last edited:
  • #80
yungman said:
The solution Explorer that I got back using View-->Solution Explorer has less and not include like above as shown below. It's missing the two:
In your 2nd screen shot, the one with Solution Explorer for your Temp project, just below where it says Solution Explorer, there are four icons. The fourth one, just to the right of the house icon, has a dropdown menu. This icon toggles between the VS solution hierarchy and the directory hierarchy. In the 2nd screen shot, you're showing the directory hierarchy. In the first screen shot, you're showing the solution hierarchy.
 
  • #81
Mark44 said:
In your 2nd screen shot, the one with Solution Explorer for your Temp project, just below where it says Solution Explorer, there are four icons. The fourth one, just to the right of the house icon, has a dropdown menu. This icon toggles between the VS solution hierarchy and the directory hierarchy. In the 2nd screen shot, you're showing the directory hierarchy. In the first screen shot, you're showing the solution hierarchy.
Thank Mark for all the help.
Now I know.

But I did something more stupid along the way last night. I think I deleted something. If I knew about toggling the hierarchy, I might not accidentally deleted the folder. Here is the screen shot of the Solution Hierarchy of Project2 that was working before. You can see the the Header folder and Source folder are all gone. There is no file in it. You can see below there there is no Header folder and Source folder. All the files have yellow triangle with '!', there is no file in them and obviously cannot compile, everything is gone.

This is Project2, it was a working program that I use Add--> Existing to link Temp.h to the Header folder and Temp.cpp and source.cpp to the Header folder from external folder. How do I get those back. I added back those folders manually, it worked last night, but I cannot repeat it on this project.

Solution Explorer short.jpg


Thanks
 
  • #82
Here's what I said before in post #77.
Mark44 said:
Best thing to do is to save the three files (the two .cpp files and the header file) somewhere, close VS, and from Windows Explorer, delete the directories.
Then start from scratch with a new project. If you have deleted the Temp directory and everything under it (after saving the three files I mentioned), you can
create a new empty project (you can call it Temp or whatever),
In VS, Add --> New items in the Source Files directory.
In VS, Add --> New items in the Include Files directory.
Copy each of the saved files into the source file and header file place-holders
Build.
Since we're just going around in circles, with little or no forward progress, I'm closing this thread.
 
  • Like
Likes Vanadium 50

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
755
  • Programming and Computer Science
Replies
33
Views
2K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
6
Views
9K
  • Programming and Computer Science
Replies
2
Views
1K
Back
Top