seems like linking with the pthread library is missing. add "pthread" under build->settings->tool settings->gcc c++ linker->libraries.
this is what my build log says:
**** build of configuration debug for project testpthreads **** make all building file: ../main.cpp invoking: gcc c++ compiler g++ -o0 -g3 -wall -c -fmessage-length=0 --std=c++0x -pthread -mmd -mp -mf"main.d" -mt"main.d" -o "main.o" "../main.cpp" finished building: ../main.cpp building target: testpthreads invoking: gcc c++ linker g++ -o "testpthreads" ./main.o -lpthread finished building target: testpthreads
your code then works and outputs:
launched by thread launched by thread launched by thread 1 launched by thread 0 launched by thread 2 launched by thread 9 launched by thread 3 launched by thread 7 launched by thread 6 4 launched by thread 8 5
i get the same error as you without -lpthread
my linker settings:
- How to configure opencv in Eclipse for Java developers with plugin CDT?
- How to configure Eclipse with Gradle in multi project?
- How to configure jboss application server with eclipse IDE
- How do I configure Eclipse to use an existing git repository with existing source code?
- How to configure Eclipse to automatically insert import statements for classes with a single package match
- How to configure Eclipse with CDT?
- How (if possible) can I configure Eclipse with Intellij IDEA keyboard shortcuts?
- How to configure Intellij toString() template to align with Eclipse
- Configure classpath in eclipse for JUnit 5 with Maven
- configure MinGW with Eclipse CDT
- How to configure Hibernate Tools HQL editor in Eclipse with a custom NamingStrategy
- Configure eclipse with c++11
- How to configure Auto-Value with Eclipse and Gradle?
- How to configure Eclipse CDT with GDB debugger
- How to Configure Eclipse to Work with `ehcache`
- How to configure jboss application server with eclipse IDE?
- Configure Eclipse to use OpenJFX with OpenJDK without manually adding --add-module in Run Configurations?
- How to configure build.gradle for testing in Android Studio with Eclipse folder structure?
- Proper way to configure Google Eclipse Plugin with Maven
- Configure Eclipse 3.7 with MinGW?
- How do you configure Eclipse with Python & GAE for integrated debugging?
- Why is recommended to configure an Eclipse Java project with SWT like a project?
- How do you configure eclipse to work with a project that wasn't created by it (java)
- Configure Google closure tools with Eclipse IDE
- How to configure tomcat 7 in Eclipse 3.6 with jdk 1.6.0_20?
- Configure CodeIgniter 2.1+ for autocomplete in Dreamweaver or Eclipse with PDT
- Configure Eclipse with websphere liberty tools with Java EE 7 javadoc integration
- How to configure solr4 with eclipse Kepler?
- How can I configure additional eclipse settings with m2eclipse?
- configure eclipse indigo cvs for one workspace referencing two cvs servers with differing cvs_server
More Query from same tag
- eclim error while processing function, cannot ping server
- Android ==> Memory Analysing ==> Eclipse memory analyzer?
- No target available in Android project
- importing existing project into eclipse
- Using radio button in different switch to add variables in android
- How to write test script in eclipse for appium using Appcenter & AWS as a device farm?
- Why are jsp:include pages with get parameters marked as error in eclipse?
- Android support v7 library gives bunch of missing resources error
- How to run ant from an Eclipse plugin, send output to an Eclipse console, and capture the build result (success/failure)?
- Gradle Build export error in Android ADT
- How to install Flex Builder 3 plugin to eclipse Mars.2
- how to change text color without changing the the whole textview color
- Eclipse Helios having performance problems Mac OS X 10.6.5
- How to detect 3 key presses in SWT KeyListener
- What does the Sample Project types stand for when creating a Gradle project in Eclipse?
- Eclipse - Java Issue finding the controller
- jsp pages sql error using tomcat and eclipse error = : The index 1 is out of range
- Is there a way to tell Eclipse how to resolve ambiguous java names?
- With some known probability,set the value of a variable
- Eclipse ADT - project structure changed showing blank packages
- How to import a project to eclipse using jcraft ftp plugin
- Recommended way to develop using Jetty and Eclipse
- Why has eclipse highlighted lines of java?
- Eclipse plugins located in workspace?
- Eclipse : How to put break points inside a class (outside the method )
- Project is missing required library - but correct JAR exists?
- Starting eclipse with configured JVM from windows batch file
- How to remove error Eclipse project indicator if I don't have any error?
- Ljava.lang.String class cannot be resolved in persistence.xml
- Supporting toggle between new file-types in eclipse or eclipse CDT