如何解决如何在vscode中运行cpp应用程序的gtk+?
我正在 cpp 中使用 gtk+ 应用程序,我希望 Bastler Pylon 与 gtk 集成,我通过大量研究发现 Gtk+ 应用程序使用 MinGw 编译器而 Pylon 使用 MSVC 编译器我的问题是在 vscode ide 中运行 gtk+ 代码,我从来没有在我通常在 ubuntu 中使用 sublime 文本编辑器之前使用过 vscode,我想在 windows 中进行以上集成......
我的四个文件结构如下...
c_cpp_properties.json
{
"configurations": [
{
"name": "Gtk_dev","includePath": [
"${workspaceFolder}/**","C:/msys64/mingw64/include/**","C:/msys64/mingw64/lib/glib-2.0/include"
],"defines": [
"_DEBUG","UNICODE","_UNICODE"
],"compilerPath": "C:/msys64/mingw64/bin/gcc.exe","cStandard": "gnu17","cppStandard": "gnu++14","intelliSenseMode": "gcc-x64","compilerArgs": [],"browse": {
"limitSymbolsToIncludedHeaders": false,"path": []
}
}
],"version": 4
}
launch.json
{
"version": "0.2.0","configurations": [
{
"name": "g++.exe - Build and debug active file","type": "cppdbg","request": "launch","program": "${fileDirname}/${fileBasenameNoExtension}","args": [],"stopAtEntry": false,"cwd": "C:\\msys64\\mingw64\\bin","environment": [],"externalConsole": false,"MIMode": "gdb","miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe","setupCommands": [
{
"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true
}
],"prelaunchTask": "C/C++: g++.exe build active file"
}
]
}
tasks.json
{
"version": "2.0.0","tasks": [
{
"type": "shell","label": "C/C++: gcc.exe build active file","command": "g++","args": [
"-g","-pthread","-mms-bitfields","-IC:/msys64/mingw64/include/gtk-3.0","-IC:/msys64/mingw64/include/cairo","-IC:/msys64/mingw64/include","-IC:/msys64/mingw64/include/pango-1.0","-IC:/msys64/mingw64/include/fribidi","-IC:/msys64/mingw64/include/atk-1.0","-IC:/msys64/mingw64/include/lzo","-IC:/msys64/mingw64/include/freetype2","-IC:/msys64/mingw64/include/libpng16","-IC:/msys64/mingw64/include/harfbuzz","-IC:/msys64/mingw64/include/pixman-1","-IC:/msys64/mingw64/include/gdk-pixbuf-2.0","-IC:/msys64/mingw64/include/glib-2.0","-IC:/msys64/mingw64/lib/glib-2.0/include","${C:/msys64/mingw64/bin/g++}","-LC:/mingw64/lib","-lgtk-3","-lgdk-3","-lz","-lgdi32","-limm32","-lshell32","-lole32","-luuid","-lwinmm","-ldwmapi","-lsetupapi","-lcfgmgr32","-lpangowin32-1.0","-lpangocairo-1.0","-lpango-1.0","-lharfbuzz","-latk-1.0","-lcairo-gobject","-lcairo","-lgdk_pixbuf-2.0","-lgio-2.0","-lgobject-2.0","-lglib-2.0","-lintl","-o","${fileDirname}/${fileBasenameNoExtension}"
],"options": {
"cwd": "C:/msys64/mingw64/bin"
},"problemmatcher": [
"$gcc"
],"group": {
"kind": "build","isDefault": true
}
},{
"type": "cppbuild","label": "C/C++: g++.exe build active file","command": "C:\\msys64\\mingw64\\bin\\g++.exe","${file}","${fileDirname}\\${fileBasenameNoExtension}.exe"
],"options": {
"cwd": "C:\\msys64\\mingw64\\bin"
},"group": "build","detail": "compiler: C:\\msys64\\mingw64\\bin\\g++.exe"
}
]
}
错误显示.........by Pressing for compile and run(ctr+shift+B)..主要问题是没有提到哪个文件有错误
g++.exe: error: .0: No such file or directory
g++.exe: error: .0: No such file or directory
g++.exe: error: .0: No such file or directory
g++.exe: error: .0: No such file or directory
.....some included files output.....
解决方法
我昨天遇到了同样的错误。错误消息实际上暗示出了什么问题 (.0)。一些链接的库 (-l) 的名称中有 .0 这似乎是一个问题(至少在 Windows 上)。将相应的库放入单引号中即可:
tasks.json
[...]
"-lcfgmgr32","'-lpangowin32-1.0'","'-lpangocairo-1.0'","'-lpango-1.0'","-lharfbuzz","'-latk-1.0'","-lcairo-gobject","-lcairo","'-lgdk_pixbuf-2.0'","'-lgio-2.0'","'-lgobject-2.0'","'-lglib-2.0'","-lintl",[...]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。