Problem with C++ header using whatever IDE or editor

I’m completely a newbie in the coding world. Been learning C++ for some days. I actually bought my MBA M1 to learn coding. But problems seem to appear whenever I tried to code #include <iostream>. I use the latest Codelite as my IDE and when I hover towards the red arrow it says the following- error: no member named 'nullptr_t' in the global namespace I have tried this investigation provided by Eskimo -

https://developer.apple.com/forums/thread/734833

But again the same errors keep occurring. As a complete newbie, I don’t know much things about these so any help would be amazing for me….

FYI I use the latest clang version as my command line tool and SIP is enabled. I tried restarting my Mac and tried multiple IDEs and code editors like vscode and nano etc. and macOS default terminal, but the the error kept the the same. Also running Ventura 13.3.1 ……

Please provide me simply explained instructions to solve this annoying problem…..

Accepted Reply

Your second screenshot almost shows us the commands that your GUI invokes to compile and link, but they are truncated.

If you run those commands from the terminal, do they work?

Replies

I have tried this investigation provided by Eskimo

Please ‘show your work’ here.

In that post I include a Terminal transcript showing how I compile a simple C++ program. Please run through those steps until you get to a failure, and then post the full transcript here.

IMPORTANT Use a code block otherwise your transcript will be unreadable. See Quinn’s Top Ten DevForums Tips for info on how to do that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Extremely sorry Eskimo for late reply... I tried your C++ example-


#include <iostream>

int main()
{
    std::cout << "Hello Cruel World!\n";
}

And here are the results-


%cat hello.cpp
#include <iostream>

int main()
{
    std::cout << "Hello Cruel World!\n";
}                                                  

% clang++ -o hello hello.cpp
% ./hello
Hello Cruel World!


This time it builds fine, but now when I try it in a workspace opened in CodeBlocks IDE(which I regularly have to do), it produces the same error at <iostream> that 'no member named "nullptr_t" found in the global namespace'. I don't have any idea why it's not working in any workspaces because I try to do exactly what my instructor at Udemy tells. But it works when I create the hello.cpp file via any IDEs or text editor like nano etc. It shows errors like these-(I'm providing them as screenshots as warnings my IDE shows can not be copied)

Your second screenshot almost shows us the commands that your GUI invokes to compile and link, but they are truncated.

If you run those commands from the terminal, do they work?

Thanks endecotp for your reply. I have provided these commands and results-


%cat hello.cpp
#include <iostream>

int main()
{
    std::cout << "Hello Cruel World!\n";
}  

                                                

% clang++ -o hello hello.cpp
% ./hello
Hello Cruel World!


These were run via terminal. Were you asking about these?

Also here are the outputs-

Please provide me simple instructions, I'm really at a loss what to do anything excluding these......

Were you asking about these?

No.

I'm asking about what I can see in one of the screenshots that you posted. It shows the command that the GUI tool has invoked. It starts /usr/bin/g++ -c. I can't see all of it because there is a scrollbar and some of it has not been captured in the screenshot.

Sorry for misunderstanding Endecotp. Here are the full screenshots of the build-

What should I do now?

Can't you copy and paste, rather than posting screenshots with the scrollbar moved?

Anyway, we can now see all of the command that it is running (I think).

What happens when you run that from the terminal?

I'm trying to post what I got while running the code from the sample project workspace from terminal-


/tmp/codelite-exec.sh ; exit;
~ % /tmp/codelite-exec.sh ; exit;
Hello Cruel World!
Hit any key to continue...


I again tried to completely run the code from terminal. So I created a file named hello.cpp from Codelite and ran it via the terminal using instructions from both Eskimo and online- outputs from Eskimo's instructions-


~ % cat hello.cpp
#include <iostream>

int main()
{
    std::cout << "Hello Cruel World!\n";
}  

~ % clang++ -o hello hello.cpp
~ % ./hello
Hello Cruel World!


Using online instructions-


~ % g++ -o hello hello.cpp
~ % ls -la
total 176
...
-rwxr-xr-x    1 thisisirk  staff  39730 Sep 11 12:58 hello
-rw-r--r--    1 thisisirk  staff     78 Sep 11 12:53 hello.cpp
drwxr-xr-x    3 thisisirk  staff     96 Sep  8 17:05 hello.dSYM
...
~ % ./hello
Hello Cruel World!

Seems like both methods working fine. What should I do now?

Can anyone help me out? This problem still exists...

I arrived here because I'm in the exact same situation, I started the Udemy class, followed along and got that red arrow pointing to the same exact error as yours in CodeLite. I'm on Ventura 13.2.1. Hope someone will explain it, I'm also very new to all of this.

I started the Udemy class

Is this something free? If so, can you post a link to it? If I have some spare cycles I might give it a try.

ps When posting your link, heed tip 14 in Quinn’s Top Ten DevForums Tips.

pps You wrote:

I'm on Ventura 13.2.1.

Yowsers! While it’s nothing to do with this issue, there have been some pretty important security fixes since then, so it’s definitely time to update.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • No, it isn't free, I'm sorry. This is the course, anyway: https://www.udemy.com/course/beginning-c-plus-plus-programming/

Add a Comment

Eskimo did you see my latest terminal outputs I posted? If so, please help with your instructions....

You need to try to run the commands that your CodeLite GUI is running, which we can see in the screenshots, in the terminal. You still haven't done that.

When i run that from terminal,it displays-


/tmp/codelite-exec.sh ; exit;
thisisirk@thisisirk ~ % /tmp/codelite-exec.sh ; exit;
Hello Cruel World!
Hit any key to continue...

I again tried to completely run the code from terminal. So I created a file named hello.cpp from Codelite and ran it via the terminal using instructions from both Eskimo and online- outputs from Eskimo's instructions-

#include <iostream>

int main()
{
    std::cout << "Hello Cruel World!\n";
}  

~ % clang++ -o hello hello.cpp
~ % ./hello
Hello Cruel World!

Using online instructions-

~ % g++ -o hello hello.cpp
~ % ls -la
total 176
...
-rwxr-xr-x    1 thisisirk  staff  39730 Sep 11 12:58 hello
-rw-r--r--    1 thisisirk  staff     78 Sep 11 12:53 hello.cpp
drwxr-xr-x    3 thisisirk  staff     96 Sep  8 17:05 hello.dSYM
...
~ % ./hello
Hello Cruel World!

Seems like both methods working fine. What should I do now?

You are NOT running the same commands that the CodeLite GUI is running.

We can see the commands that it runs in your screenshots.

Run those same commands in the terminal.