Vipul Sharma
Vipul Sharma

Reputation: 71

Including CPPUnit test in visualcode

I'm working on this tutorial from: http://www.evocomp.de/tutorials/tutorium_cppunit/howto_tutorial_cppunit.html and I am not able to include headers from the CPPUnit directory in Visual Code on mac. The CPPUnit is installed on my ~ folder such as for an example header file like HelperMacos.h,v the path is:

~/cppunit-cvs-repo-archive/cppunit/extensions/HelperMacros.h,v

I have tried to include the path under includePath section in c_cpp_properties.json by adding this line:

 "~/cppunit-cvs-repo-archive/cppunit/",
"~/cppunit-cvs-repo-archive/cppunit/include/",
"~/cppunit-cvs-repo-archive/cppunit/extensions/"

for including the header files in my visual studio code but the program is giving me an error. For example it says: cannot open source file "cppunit/TestCaller.h" (dependency of "cppunit/extensions/HelperMacros.h,v") when I try to include:

#include <cppunit/exetnsions/HelperMacros.h,v>

Upvotes: 0

Views: 838

Answers (1)

Dhwani Katagade
Dhwani Katagade

Reputation: 1290

The correct setting for includePath in c_cpp_properties.json in case of the original question should be something like the following

"includePath": [
    "${workspaceFolder}/**",
    "~/cppunit-cvs-repo-archive/"
],
"macFrameworkPath": [
    "/System/Library/Frameworks", 
    "/Library/Frameworks"
],

The cppunit installation location has to be specified only up to the root directory that contains the cppunit directory.

The system library include paths are specified on Mac via the macFrameworkPath property as mentioned here.

Upvotes: 0

Related Questions