Skip to content

Commit 7261d4c

Browse files
committed
Fix linker issues when building on Ubuntu
1 parent 62ba5de commit 7261d4c

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818

1919
- name: install dependencies
2020
run: |
21-
sudo apt-get update -y
22-
sudo apt-get install -y libglfw3 libglew-dev libstb-dev libglm-dev
21+
sudo apt update -y
22+
sudo apt install -y libglfw3-dev libglew-dev libstb-dev libglm-dev
2323
2424
- name: make
2525
run: make

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ CFLAGS = -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy \
33
-Wmissing-include-dirs -Wnoexcept \
44
-Woverloaded-virtual -Wredundant-decls -Wshadow \
55
-Wsign-conversion -Wsign-promo -Wstrict-null-sentinel \
6-
-Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused
6+
-Wswitch-default -Wundef -Werror -Wno-unused
77

88
# these are annoying
99
# -Wmissing-declarations -Wold-style-cast
1010

11-
LDFLAGS = -lGL -lglfw -lGLEW
11+
LDFLAGS = -lGLEW -lGL -lGLU -lglfw
1212

1313
TARGET = bin/out
1414
SOURCES = $(wildcard src/*.cpp)
@@ -30,7 +30,7 @@ bin:
3030
mkdir -p $@
3131

3232
$(TARGET): $(OBJS) | bin
33-
g++ $(CFLAGS) $(LDFLAGS) $^ -o $(TARGET)
33+
g++ $^ -o $(TARGET) $(LDFLAGS)
3434

3535
build/%.o: src/%.cpp | build
3636
g++ $(CFLAGS) -MMD -MP -c $< -o $@

src/camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "camera.h"
55

6-
Camera::Camera(float aspectRatio) { Camera::aspectRatio = aspectRatio; }
6+
Camera::Camera(float aspect) { Camera::aspectRatio = aspect; }
77

88
void Camera::moveForward(float amount) { pos += front * amount; }
99

src/camera.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Camera {
2020

2121
float aspectRatio;
2222

23-
Camera(float aspectRatio);
23+
Camera(float aspect);
2424

2525
void moveForward(float amount);
2626
void moveSideways(float amount);

src/texture.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
#include "texture.h"
99

10-
Texture::Texture(const std::string &path, unsigned int filter,
11-
unsigned int wrap) {
10+
Texture::Texture(const std::string &path, GLint filter, GLint wrap) {
1211
// create a texture object
1312
glGenTextures(1, &ID);
1413
glBindTexture(GL_TEXTURE_2D, ID);
@@ -40,7 +39,7 @@ Texture::Texture(const std::string &path, unsigned int filter,
4039
<< " channels which is unhandled case!" << std::endl;
4140
}
4241
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
43-
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format,
42+
glTexImage2D(GL_TEXTURE_2D, 0, (GLint)format, width, height, 0, format,
4443
GL_UNSIGNED_BYTE, data);
4544
glGenerateMipmap(GL_TEXTURE_2D);
4645
} else {

src/texture.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#ifndef TEXTURE_H
22
#define TEXTURE_H
33

4+
#include <GL/glew.h>
45
#include <fstream>
56

67
class Texture {
78
public:
89
unsigned int ID;
910
int width, height, nrChannels;
1011

11-
Texture(const std::string &path, unsigned int filter, unsigned int wrap);
12+
Texture(const std::string &path, GLint filter, GLint wrap);
1213
void use(unsigned int texture_id);
1314
};
1415

0 commit comments

Comments
 (0)