#complie
g++ HelloWorld.cpp
#运行
./a.exe
g++ -c Log.cpp
#单个
ar rcs Log.lib Log.o
#多个
ar rcs Log.lib Log.o Log1.o
g++ -Wall -static HelloWorldTest.cpp -L. -lLog
Log.cpp
#include "Xingyu.h"
#include
void Log(const char* message)
{
std::cout << message << std::endl;
}
void hello()
{
std::cout << "what the" << std::endl;
}
Log1.cpp
#include "Xingyu.h"
#include
void hello1()
{
std::cout << "what the fuck" << std::endl;
}
HelloWorldTest.cpp
#include "Xingyu.h"
//#include "Log.cpp"
#include
#include
using namespace std;
int main()
{
cout << "Hello World!!!!!!!test" << endl;
// Log("Call the Log function");
// hello();
// hello1();
cin.get();
//printf("111");
//getchar();
//return 0;
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "D:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
#编译要debug的文件
g++ -g .\HelloWorldTest.cpp