Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
OOP-SoSe22 OOP-SoSe22
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 16
    • Issues 16
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Thibaut Lunet
  • OOP-SoSe22OOP-SoSe22
  • Issues
  • #63

Closed
Open
Created May 17, 2022 by Thibaut Lunet@cpf5546Maintainer

S3 (and next ...) : setting include path to VSCode so it can find your header files

Description of the problem

Maybe some of you still have this problem : starting from S3, when a Makefile should be used to compile your code, compilation works using the make command, but there is still some error shown in VSCode, because it cannot find your code. Here are a few tips to solve this ...

Solution

Use of a c_cpp_properties.json file

In your project, you have a .vscode directory where VSCode put all the settings associated to this project. Just add in there a file named c_cpp_properties.json, and write the following configuration in it :

{
   "configurations": [
      {
         "name": "Linux",
         "includePath": [
            "${workspaceFolder}/[studentID]/**"
         ],
         "defines": [],
         "compilerPath": "/usr/bin/g++",
         "intelliSenseMode": "linux-gcc-x64"
      }
   ],
   "version": 4
}

Here I consider that your project repository, represented by the workspaceFolder variable, is simply the gitlab repository of your group (that contains each student repository named with their studentID). So replacing [studentID] with your own studentID will indicate to VSCode to search header in all of your sub-directory in your own.

Handling same header files for different series

One issue can occurs if you use the same name header files for different exercises. Since VSCode will look into each exercise series, it may mix the different includes together. To avoid this, just specialize the includePath link :

"includePath": [
   "${workspaceFolder}/[studentID]/s3/include"
],

for S3. You also add multiple directory to the includePath using for instance :

"includePath": [
   "${workspaceFolder}/[studentID]/s3/include",
   "${workspaceFolder}/[studentID]/s4/include",
],

just don't forget the comma 😏 .

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking