Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lecture materials
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
generic software skills
lecture materials
Commits
aeaec7cc
Commit
aeaec7cc
authored
11 months ago
by
Dominik Zobel
Browse files
Options
Downloads
Patches
Plain Diff
Add cpp compiler example
parent
90bd4724
No related branches found
No related tags found
1 merge request
!56
Debugging Strategies lecture notes
Pipeline
#66853
passed
11 months ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lectures/debugging-strategies/slides.qmd
+76
-2
76 additions, 2 deletions
lectures/debugging-strategies/slides.qmd
with
76 additions
and
2 deletions
lectures/debugging-strategies/slides.qmd
+
76
−
2
View file @
aeaec7cc
...
@@ -52,9 +52,82 @@ digraph {
...
@@ -52,9 +52,82 @@ digraph {
- Learn to understand what the compiler tries to tell you
- Learn to understand what the compiler tries to tell you
## Example
## GCC C++ compiler examples (1/x) {.leftalign}
::::::::{.columns}
:::{.column width=45%}
```cpp
#include <iostream>
int main() {
using namespace std;
cout << "Hallo" << endl;
return 0;
}
```
Compiling with
`gcc test.cpp -o test`
:::
:::{.column width=55% .smaller}
```
/usr/bin/ld: /tmp/ccrbNm7k.o: warning: relocation against `_ZSt4cout' in read-only section `.text'
/usr/bin/ld: /tmp/ccrbNm7k.o: in function `main':
test.cpp:(.text+0x15): undefined reference to `std::cout'
/usr/bin/ld: test.cpp:(.text+0x1d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/usr/bin/ld: test.cpp:(.text+0x24): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/usr/bin/ld: test.cpp:(.text+0x2f): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/usr/bin/ld: /tmp/ccrbNm7k.o: in function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x66): undefined reference to `std::ios_base::Init::Init()'
/usr/bin/ld: test.cpp:(.text+0x81): undefined reference to `std::ios_base::Init::~Init()'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
```
:::
::::::::
## GCC C++ compiler examples (1/x) {.leftalign}
::::::::{.columns}
:::{.column width=45%}
```cpp
#include <iostream>
int main() {
using namespace std;
cout << "Hallo" << endl;
return 0;
}
```
Compiling with
`g++ test.cpp -o test`
:::
:::{.column width=55% .smaller}
Compilation succeeded
:::
::::::::
TODO
## Compiler flags for compilation output {.leftalign}
## Compiler flags for compilation output {.leftalign}
...
@@ -76,6 +149,7 @@ Also gcc compile time checks and options like
...
@@ -76,6 +149,7 @@ Also gcc compile time checks and options like
Summary
Summary
# Run-time errors {.leftalign}
# Run-time errors {.leftalign}
- Let the compiler help you if something goes wrong
- Let the compiler help you if something goes wrong
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment