I need to know why VS code is not compiling ncurses.h. but it is possible to compile in the terminal ubuntu. this message is appearing on the VS code. (.text+0xd): undefined reference to `initscr'
            Asked
            
        
        
            Active
            
        
            Viewed 285 times
        
    1
            
            
        - 
                    It might be compiler option issue. Could you be sure VS Code compile options for ncurses.h library? – LORDTEK Oct 24 '21 at 19:16
- 
                    "C_Cpp.default.cppStandard": "c++14", – ricardo Oct 24 '21 at 19:21
- 
                    https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix – n. m. could be an AI Oct 24 '21 at 19:34
2 Answers
1
            
            
        I solved this problem adding "-lncurses" in the "args" (tasks.json)
"args": [
    "-g",
    "${file}",
    "-o",
    "${fileDirname}/${fileBasenameNoExtension}",
    "-lncurses" <--------- add the library ("-lncurses" ) here 
],
 
    
    
        Andronicus
        
- 25,419
- 17
- 47
- 88
 
    
    
        ricardo
        
- 27
- 3
0
            
            
        the code runner extension configuration add -lncurses before -o
"code-runner.executorMap": { "c": "cd $dir && gcc $fileName -lncurses -o $fileNameWithoutExt && $dir$fileNameWithoutExt " }
 
    
    
        ricardo
        
- 27
- 3
- 
                    1As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 25 '21 at 01:40