Import not recognized

Post Reply
Posts: 1
Joined: Tue Apr 16, 2019 10:24 am

Import not recognized

Post by Sumandora » Tue Apr 16, 2019 10:34 am

Hey my code is to generate a simple Thread which print something.
But here is a problem the Thread needs an Import but the Import dont get found:

Code: Select all

#include <iostream>
#include <thread>

using namespace std;

int main(){

  cout << endl;

  thread t3([]{cout << "Imma Thread" << endl;});


  cout << endl;


Code: Select all

aarch64-none-elf-g++ -MMD -MP -MF /home/Anwender/Desktop/FuseeGelee/Threads/build/main.d -g -Wall -O2 -ffunction-sections -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE  -I/home/Anwender/Desktop/FuseeGelee/Threads/include -I/opt/devkitpro/portlibs/switch/include -I/opt/devkitpro/libnx/include -I/home/Anwender/Desktop/FuseeGelee/Threads/build -D__SWITCH__ -fno-rtti -fno-exceptions -c /home/Anwender/Desktop/FuseeGelee/Threads/source/main.cpp -o main.o
C:/Users/Anwender/Desktop/FuseeGelee/Threads/source/main.cpp: In function 'int main()':
C:/Users/Anwender/Desktop/FuseeGelee/Threads/source/main.cpp:12:3: error: 'thread' was not declared in this scope
   thread t3([]{cout << "Hello C++11 from lambda function." << endl;});
C:/Users/Anwender/Desktop/FuseeGelee/Threads/source/main.cpp:12:3: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
+#include <thread>

   thread t3([]{cout << "Hello C++11 from lambda function." << endl;});
C:/Users/Anwender/Desktop/FuseeGelee/Threads/source/main.cpp:12:69: error: expected primary-expression before ')' token
   thread t3([]{cout << "Hello C++11 from lambda function." << endl;});
C:/Users/Anwender/Desktop/FuseeGelee/Threads/source/main.cpp:14:3: error: 't3' was not declared in this scope
C:/Users/Anwender/Desktop/FuseeGelee/Threads/source/main.cpp:14:3: note: suggested alternative: 'tm'
make[1]: *** [/opt/devkitpro/devkitA64/base_rules:14: main.o] Error 1
make: *** [Makefile:165: build] Error 2

User avatar
( ͡° ͜ʖ ͡°)
Posts: 54
Joined: Mon Jul 12, 2010 9:45 pm
Location: Seville, Spain

Re: Import not recognized

Post by fincs » Tue Apr 16, 2019 12:13 pm

1) Are you sure you have latest tools and libraries? Please do pacman -Syu to ensure you're upgraded.
2) You're missing console init/deinit code, and other scaffolding code. Please take a look at the template source code to see what a typical console homebrew application should look like.
3) iostreams are a really questionable part of the C++ standard library that adds a lot of code size bloat and code verboseness for little, if not dubious benefit. It is usually recommended by us to stick to standard printf.
Donate to devkitPro - help us stay alive!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest