How to inspect an external .cpp file? - resharper

I have in the project a cpp file that is outside the dir tree. Resharper c++ doesn't enable inspection, such as go to definition.
Resharper version 2022.1.2
Visual studio 2019 and 2022
It didn't help enabling
options> code editing> c++> inspection> enable on external modules
Also, it's not an external file, it's a cpp that is part of the project.
There's also this
https://www.jetbrains.com/help/resharper/Reference__Options__Tools__External_Sources.html
but the option doesn't appear under tools.
The problem is with resharper; VS inspection (go to definition) works fine.
I found the problem, and it's weird. Say I want to add to the project the file:
c:\prj\confstruct\src\debug\mpir.cpp
which is outside the project directory.
If in cmake I use the abs path (given as a parameter to add_executable):
/prj/confstruct/src/debug/mpir.cpp
then resharper ignores the file.
If I add the drive letter:
c:/prj/confstruct/src/debug/mpir.cpp
Then resharper works fine.

Make sure that the file is used somewhere in your project, i.e. is included into one of your .cpp files. Turn on the "Enable inspections, quick fixes and context actions in files external to the solution" option in ReSharper settings:

Related

strip comments when compiling TypeScript to JS - option to do so in tools via webessentials missing

I cannot find the option to keep / strip comments when compiling typescript as suggested here : Unable to see comments in javascript files generated by TypeScript
here are my options in visual studio 2012
How can I configure my type script compiler to strip comments in the resulting Javascrip
You should be able to set this in the project settings.
Project > Properties > TypeScript Build
If your project pre-dates this change, you can add the following to your project file manually. This usually also kicks the project settings into life so you can edit it in the normal place once you have added it manually once.
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptModuleKind>amd</TypeScriptModuleKind>
<TypeScriptNoImplicitAny>True</TypeScriptNoImplicitAny>
<TypeScriptRemoveComments>true</TypeScriptRemoveComments>
</PropertyGroup>
The TypeScriptRemoveComments in particular is the bit you are interested in, but you should add the whole block and then edit it to suit your needs.

Visual Studio: Exclude From Project Quickly

I have got thousands of files/folders inside a solution. For some reason I have to exclude them all and then include again in the project, to get the latest list of files.
The normal "Exclude From Project" in visual studio menu takes too much time. Is there a quick way to do it?
Thanks!
Put them all into one master folder and include that folder.
If some are files, you may also want to compile them and include the DLLs or the equivalent in whatever language you're using.

Specify include paths individually per source file for Visual Studio C++

Is it possible to specify include paths individually for each soucre *.cpp file?
Eclipse uses this method for code assistance, see Discovery Options properties
In Visual Studio 2010, all I can see is that one can only define the include paths project-wide.
It would be nice if this individual information could then be used for the IntelliSense compiler to parse only the current active source file.
As far as I know IntelliSense parses all files at once, which I think is not appropriate for verly large projects.

Configure a Visual C++ 2010 project to use include folder as in Linux

I'm porting a Linux C project in Visual Studio 2010.
I have the following folder project structure under linux:
ProjectName->Src->Source C files
ProjectName->Header->Source H files related to C
How should I configure Visual Studio 2010 to recreate the same structure without compile errors ?
How to create the include folder and tell to the the compiler that is an include folder.
I cannot even add include files (existing elements) in a simple folder. They simply don't appear as I add it.
On the C/C++ configuration tab is the Additional Include Directories option. Set it to the following:
$(ProjectDir)/Header
That should do it. Don't forget to do it for all your configs (debug, release, etc).
Oh, and regarding adding new header files, when you open the Add.. option to add a new file, pay close attention to the BOTTOM of the dialog. it will tell you where it will be placed, and you can change it there.

Visual C++ Express How Exactly Do I Link A Third Party Library DLL

YES, I have seen the posts that all you need to do is link it. Find you .lib and link. I have 10 years IT experience and its not at all clear to me where/how the link settings are made. This is a DLL that is not in another project. I have the lib and I have spent hours just trying to find out how to pull this in. Just curious, why there is not some tab saying external libraries, and a browse button to goto whereever you stored this on your file system? I just don't get the multiple steps to get this file linked up. Someone please spell it out. I'm on Visual C++ Express 2010.
Did you try just using "Add Existing File to Project", browsing to the .lib and adding it? Visual Studio recognizes the file type and passes .lib files to the linker.
There's another way which is more complicated and also more powerful. You can open the project properties by right-clicking the project in Solution Explorer. Then go to the Project Directories and add the path to the LIB paths, then go to Linker Input and add the library name (without path) under additional inputs. The advantage of this second method is that you can have different versions of the .lib and .dll for release vs debug, or 32-bit vs 64-bit builds.
In addition to Bens answer, you can also use pragma directives:
#pragma comment ( lib, "path-to-library-file.lib" )
Some prefer linking libraries in the project, others prefer it in the source file. It doesn't make much of a difference either way.

Resources