Open solracnauj1990 opened 1 year ago
this means that you don't have
#define OLC_PGE_APPLICATION
line at the top of your main file. For more information, check out: https://github.com/OneLoneCoder/olcPixelGameEngine/wiki/Compiling-on-Linux and https://github.com/OneLoneCoder/olcPixelGameEngine/wiki/Multiple-File-Projects and probably https://github.com/OneLoneCoder/olcPixelGameEngine/wiki/Hello-World
Thank you so much!!! It worked!! :)
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 toolc::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 toolc::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 toolc::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.