Jun 5, 2012 at 11:53pm UTC
I am trying to include atomic in my C++ pthread program.
#include <atomic>
But, i got error:
error: atomic: No such file or directory
I tried :
#include <asm/atomic>
#include <atomic.h>
#include <linux/atomic>
#include <util/atomic>
#include <stdcatomic>
#include <catomic>
No one works.
My gcc is gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)
The post :
#include <cstdatomic> "no such file" in ubuntu
std::atomic support in g++ 4.4.3
do not work either.
And #include <thread> also got : No such file or directory
So, I am trying to install GCC 4.7 on Linux, but in "make check", I got error,
autogen -T /remote/mypath/gcc_4_7_2012_5_28/gcc_4_7_new_2012_5_29/trunk/fixincludes/check.tpl , remote/mypath/gcc_4_7_2012_5_28/gcc_4_7_new_2012_5_29/trunk/fixincludes/inclhack.def ,
make[2]: execvp: autogen: Permission denied, then I tried to install autogen, but
got: I need to install guile-devel, then when I installed guile-2.0.5-2.1.src.rpm ,
I got rpm -ivh guile-2.0.5-2.1.src.rpm, warning: guile-2.0.5-2.1.src.rpm: Header V3
RSA/SHA256 signature: NOKEY, key ID 3dbdc284
error: cannot write to %sourcedir /usr/src/redhat/SOURCES, I cannot get root
authorization.
Any help will be appreciated. thanks !
Jack
Jun 5, 2012 at 11:59pm UTC
atomic isn't a standard header file, atleast not in my compiler. Is it a custom made header that someone gave you or that you downloaded?
Try putting atomic.h into the same folder as your .cpp file, then#include "atomic.h"
Last edited on Jun 6, 2012 at 12:00am UTC
Jun 6, 2012 at 12:00am UTC
That's C++11 stuff.
#include <atomic>
g++ -std=c++0x
or
g++ -std=c++11
(whichever one works for you)
Jun 6, 2012 at 12:07am UTC
Hi,
I have tried all:
g++ -std=c++0x
g++ -std=c++11
None works.
My gcc is 4.1.2 20080704 (Red Hat 4.1.2-52), it is too old.
I need to install GCC 4.7 . but, I got errors presented in my post.
Any help will be appreciated.
Jun 6, 2012 at 12:09am UTC
I don't know too much about Linux, but have you tried uninstalling the old GCC first, then running the unstall as ROOT?
Jun 6, 2012 at 12:11am UTC
I cannot uninstall olg gcc, I do not have root authorization. thanks
Jun 6, 2012 at 12:19am UTC
*palmface* well, that's my only idea, just have to wait to see if someone else can come along that knows Linux a little better. That, or try the GCC forums? I'm sorry.