0

I am trying to build a simple/demo C/C++ application that is able to use functions from Optix 7. In order to do so:

-Under Configuration Properties > C/C++ > General,I added the Optix include directory to the Additional Include Directories.

-Under Configuration Properties > Linker > General, I added the Optix folder of the Additional Library Directories (debug).

-Under Configuration Properties > Linker > Input, I added the corresponding .lib files to the Additional Dependencies(debug).

-I copied the related dlls(debug) in my project folder.

My test app runs without any problem and I can see the called external Optix functions working as expected.

My problem is that when I ctrl+click the external function in my test app VS2019 opens only the .h file and not the corresponding.cpp.

I don't think that this has to do with the specific external library (Optix), it seems to be some VS configuration property. I tried unchecking the Just My Code, but still I cannot get into the .cpp file.

The only way to click and open the .cpp file is to put a breakpoint at the line that the Optix function is called from my test application and step into the function call. Only then I can see the .cpp file by ctrl+clicking on the external function. When I step out of the function I no longer can step into and clicking on the function name I get again to the .h file only.

In Debug/Windows/Module the optix symbol file directories are shown correctly and the corresponding .pdb file has status Symbol Status "Symbols loaded".

Any suggestions?

fatecasino
  • 49
  • 2
  • 7
  • 2
    You described exactly what it's supposed to do. VS cannot open the .cpp files by "go to definition" for files not in the current solution. Debugging actually loads the pdbs which have information about where they are created from, and so can then go into the .cpp files. You shouldn't need to see the source files of external libraries ... – ChrisMM May 19 '23 at 10:58
  • If you have the correct sources of the external library when debugging and there is a pdb file you can point Visual Studio to the source when it asks for the location. – drescherjm May 19 '23 at 14:04

1 Answers1

1

You will not be able to see the source code (*.cpp) for an external library the vast majority of the time as a consumer. The DLL might not have been compiled with the same compiler you are using, not even been compiled from C++ at all. This is why libraries are not delivered with *pdb or *cpp files with their binaries. (For open source, for closed source another big reason is knowledge protection ofc.)

nick
  • 541
  • 1
  • 9
  • you are right, my only thought is that since I can open these specific .cpp files when debugging, could it be possible to open these .cpp just when I 'm typing my own code? – fatecasino May 19 '23 at 12:17