Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:12:00+00:00 2026-06-09T17:12:00+00:00

This had been bending my mind in the last few days. I also wasn’t

  • 0

This had been bending my mind in the last few days. I also wasn’t sure whether to post this in ask ubuntu or here. I chose here to get a wider programmer-based audience.

I am brand new to Ubuntu and GCC, however I’ve been programming C++ on windows for about 5 years. This simple C++11 code sample works fine on my Windows machine with VS2010.

#include <iostream>
#include <functional>

std::function<void()> func;

int main() {
    std::cout << "!!!Hello World!!!" << std::endl; // prints !!!Hello World!!!
    return 0;
}

With Eclipse CDT (Ubuntu 12.04), I get the error Symbol 'function' could not be resolved.

I’ve made sure build-essentials is installed.

I’ve added /usr/include/c++/4.6.3 to my includes in eclipse.

I’ve added __GXX_EXPERIMENTAL_CXX0X__ to Paths and Symbols in eclipse.

I’ve tried -std=c++11 on the command line.

I’ve tried -std=c++0x on the command line.

I’ve followed the Accepted answer here: https://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7 and installed gcc 4.7

Is this not supported with gcc?

I’ve checked auto and it works, but things like unique_ptr don’t work either, same error as above.

Sorry again, I’m new to Linux.

Edit:
As per n.m.’s request:

neil@ubuntu12:~/projects/Test/Test$ g++ -v;g++ -std=c++0x -o main main.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
neil@ubuntu12:~/projects/test$
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:12:01+00:00Added an answer on June 9, 2026 at 5:12 pm

    Is this not supported with gcc?

    GCC supports it fine, you’re confusing an error from Eclipse saying its syntax highlighting and auto-completion couldn’t recognise std::function with a compiler error from GCC. They’re not the same thing.

    I’ve added __GXX_EXPERIMENTAL_CXX0X__ to Paths and Symbols in eclipse.

    This says how to make Eclipse CDT recognise C++11 names: http://wiki.eclipse.org/CDT/User/FAQ#CDT_does_not_recognize_C.2B.2B11_features

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having problems with this code I had spent the last 3 hours
I've been working at this for two days and have not had much luck.
I have been stuck on this for days, and was wondering if anyone had
I know this question had been asked a hundred times, but I have difficulties
I know that this question had already been asked a couple of times before,
Microsoft recently released to preview Azure web sites. I had been hoping that this
I had this weird problem a little while ago and haven't been able to
This question may have been asked before, but I had trouble finding an answer,
This had me pulling my hair out for a couple days: byte[] _A =
Previously I had been using this.CommandBindings.Add( new CommandBinding(ApplicationCommands.Copy, this.cmdCopy_Executed, this.cmdCopy_CanExecute)) where cmdCopy_Executed is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.