You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I have a problem with compiling a cpp file using the olcPixelGameEngine library. Everything in ubuntu.
First, i wanted to include the librarie in the program but whhen I compiled it I got the next problem in the terminal.
The command I used: g++ -o resultado helloworld.cpp
What I got: helloworld.cpp:5:10: fatal error: olcConsoleGameEngine.h: No such file or directory 5 | #include "olcConsoleGameEngine.h" | ^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
Then I downloaded the olcPixelGameEngine.h file and coppied it to /usr/include.
When I tried to compile again I got the next problem:
In file included from helloworld.cpp:5: olcPixelGameEngine.h:530:12: fatal error: X11/X.h: No such file or directory 530 | #include <X11/X.h> | ^~~~~~~~~ compilation terminated.
After that I searched in internet and found the command:
sudo apt install libx11-dev
When I runned it everything went ok.
But now when I try to compile I get the next problem:
/usr/bin/ld: /tmp/ccigeM0H.o: in function __static_initialization_and_destruction_0(int, int)':
helloworld.cpp:(.text+0x1c5): undefined reference to olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' /usr/bin/ld: helloworld.cpp:(.text+0x1e6): undefined reference to olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: helloworld.cpp:(.text+0x207): undefined reference to olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' /usr/bin/ld: helloworld.cpp:(.text+0x228): undefined reference to olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: helloworld.cpp:(.text+0x249): undefined reference to olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' /usr/bin/ld: /tmp/ccigeM0H.o:helloworld.cpp:(.text+0x26a): more undefined references to olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' follow
collect2: error: ld returned 1 exit status`
Then I searched but found nothing.
I show you the entire story to know if I did something wrong or just to find a solution.
Hope you could help me.
The text was updated successfully, but these errors were encountered:
It's quite interesting that you're including olcConsoleGameEngine instead of the olcPixelGameEngine, and then the problem is fixed by a PGE application definition. :)
Hi. I have a problem with compiling a cpp file using the olcPixelGameEngine library. Everything in ubuntu.
First, i wanted to include the librarie in the program but whhen I compiled it I got the next problem in the terminal.
The command I used:
g++ -o resultado helloworld.cpp
What I got:
helloworld.cpp:5:10: fatal error: olcConsoleGameEngine.h: No such file or directory 5 | #include "olcConsoleGameEngine.h" | ^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
Then I downloaded the olcPixelGameEngine.h file and coppied it to /usr/include.
When I tried to compile again I got the next problem:
In file included from helloworld.cpp:5: olcPixelGameEngine.h:530:12: fatal error: X11/X.h: No such file or directory 530 | #include <X11/X.h> | ^~~~~~~~~ compilation terminated.
After that I searched in internet and found the command:
sudo apt install libx11-dev
When I runned it everything went ok.
But now when I try to compile I get the next problem:
/usr/bin/ld: /tmp/ccigeM0H.o: in function
__static_initialization_and_destruction_0(int, int)':helloworld.cpp:(.text+0x1c5): undefined reference to
olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' /usr/bin/ld: helloworld.cpp:(.text+0x1e6): undefined reference to
olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)'/usr/bin/ld: helloworld.cpp:(.text+0x207): undefined reference to
olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' /usr/bin/ld: helloworld.cpp:(.text+0x228): undefined reference to
olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)'/usr/bin/ld: helloworld.cpp:(.text+0x249): undefined reference to
olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' /usr/bin/ld: /tmp/ccigeM0H.o:helloworld.cpp:(.text+0x26a): more undefined references to
olc::Pixel::Pixel(unsigned char, unsigned char, unsigned char, unsigned char)' followcollect2: error: ld returned 1 exit status`
Then I searched but found nothing.
I show you the entire story to know if I did something wrong or just to find a solution.
Hope you could help me.
The text was updated successfully, but these errors were encountered: