Been trying to follow the open gl tutorial. I copied this code down and analyzed it. I got these same errors when i copied it myself, so i decided to copy it off of the tutorial and i got the same two errors. What am i doing wrong?
Errors:
"
-------------- Build: Debug in SFML ---------------
Linking console executable: bin\Debug\SFML.exe
obj\Debug\main.o: In function `main':
C:/Users/Owner/Desktop/Everything C++/main.cpp:29: undefined reference to `glViewport@16'
C:/Users/Owner/Desktop/Everything C++/main.cpp:34: undefined reference to `glClear@4'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
2 errors, 0 warnings"
Here is the copy.paste code.
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
int main()
{
// create the window
sf::Window window(sf::VideoMode(800, 600), "OpenGL", sf::Style::Default, sf::ContextSettings(32));
window.setVerticalSyncEnabled(true);
// load resources, initialize the OpenGL states, ...
// run the main loop
bool running = true;
while (running)
{
// handle events
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
// end the program
running = false;
}
else if (event.type == sf::Event::Resized)
{
// adjust the viewport when the window is resized
glViewport(0, 0, event.size.width, event.size.height);
}
}
// clear the buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// draw...
// end the current frame (internally swaps the front and back buffers)
window.display();
}
// release resources...
return 0;
}