- GCC отказывается создавать исполняемый файл
- Thread: gcc compiler problem with , «undefined reference to ‘std::cout'»
- gcc compiler problem with , «undefined reference to ‘std::cout'»
- Re: gcc compiler problem with , «undefined reference to ‘std::cout'»
- Re: gcc compiler problem with , «undefined reference to ‘std::cout'»
- Re: gcc compiler problem with , «undefined reference to ‘std::cout'»
- Strange behaviour of std::cout in Linux
- 2 Answers 2
- Not the answer you’re looking for? Browse other questions tagged c++ printing cout or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- Не компилируется код на C++ с помощью clang
- Решение
- Решение
- Глюк с gcc
GCC отказывается создавать исполняемый файл
Init()’
collect2: выполнение ld завершилось с кодом возврата 1
Очень пытался самостоятельно разобраться, но у меня не вышло это(( Может был бы чуть сильней в английском, то что-нибудь бы да понял с ман-страницы gcc. В поиске не нашел ничего похожего на мой вопрос. Искал яндексом))
Мне сдается, что с кодом все ок( вроде как и запароть там нечего ), проблема в компиляторе)) вернее в моем неумении им пользоваться))) подскажите, что да как)) Буду очень признателен)
Добавлено через 27 минут
Ребята, разобрался))) Не ту команду давал)) надо было не gcc, а g++ )))
Добавлено через 6 минут
Да, и среднее я зашибенно искал)))
Добавлено через 16 минут
А еще можно было так сделать:
GCC Сборка 32 разрядной версии GCC 64 разрядным GCC
Доброго времени суток. Возникла необходимость под 32х разрядный Linux, собрать 32 разрядный GCC. Но.
Открыть исполняемый файл, если запущен конкретный файл
Доброго времени суток! Вот такая проблемка мучает: мне нужно решить следующую задачу: открыть.
Как включить txt файл в исполняемый файл?
Подскажите плиз как решить проблему, суть такова: в txt файле имеется таблица (разделитель — знак.
Включить в исполняемый файл бинарный файл
Собственно задача такая — есть некая программа которая пишет BIN файл во внешнее устройство. Но.
Источник
Thread: gcc compiler problem with , «undefined reference to ‘std::cout'»
Thread Tools
Display
gcc compiler problem with , «undefined reference to ‘std::cout'»
I am teaching myself C++ and have been writing some simple programs; compiling them with gcc -o myprog myprog.cc
Yesterday everything was working fine. Today the same programs that use #include now generate a lot of error message such as
Here is an example of a program that worked yesterday but not today,
I tried sudo apt-get purge build-essential
then sudo apt-get install build-essential
thinking that maybe the std library was corrupted, but it did not help.
Can anybody suggest a way forward? I am at my wit’s end.
Last edited by slickymaster; July 4th, 2014 at 11:15 AM . Reason: Added code tags
Re: gcc compiler problem with , «undefined reference to ‘std::cout'»
Moved to the Programming Talk sub-forum.
@jweiner
Please use code tags in your posts when needed. Output code posted as plain text loses its formatting and parts of it sometimes turn into smileys making it difficult to read and understand.
Re: gcc compiler problem with , «undefined reference to ‘std::cout'»
The answer is that one has to use g++ not gcc. The #include only makes sense to g++.
Re: gcc compiler problem with , «undefined reference to ‘std::cout'»
Please mark you thread as SOLVED so other people searching the forums know that it provides a working solution.
Scroll to the top of your thread and look for the Thread Tools menu item on the right of the toolbar, click on this menu item to produce a dropdown menu and then click «Mark this thread as solved».
Источник
Strange behaviour of std::cout in Linux
I am trying to print results in 2 nested for cycles using std::cout . However, the results are not printed to the console immediately, but with delay (after both for cycles or the program have been finished).
I do not consider such behavior normal, under Windows printing works OK. The program does not use threads.
Where could be the problem? (Ubuntu 10.10 + NetBeans 6.9).
2 Answers 2
std::cout is an stream, and it is buffered. You can flush it by several ways:
I am flushing the buffer before the cycle using std::endl. The problem arises when printing dot representing % of processed data inside the cycle.
If you flush the buffer before the cycle, that does not affect the output in the cycle. You have to flush in or after the cycle, to see the output.
If you don’t flush your output, your output is not guaranteed to be visible outside your program. The fact that it is not printing in your terminal is just a consequence of the default behavior in linux to do line buffering when the output is a tty. If you run your program on linux with its output piped to another thing, like
Then the default buffer will be MUCH larger, most likely it will be at least 4096 bytes. So nothing will get displayed until the big buffer gets full. but really, the behaviour is OS specific unless you flush std::cout yourself.
To flush std::cout, use :
is a shortcut to
Not the answer you’re looking for? Browse other questions tagged c++ printing cout or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
Не компилируется код на C++ с помощью clang
В формате .cpp код компилируется, а в .c не компилируется
1).Подскажите почему в формате .cpp код компилируется, а в .c не компилируется 2). Как сделать.
Почему в Dev-C++ код не компилируется, если исходный код будет с расширением «.c»?
Почему в Dev-C++ код не компилируется, если исходный код будет с расширением «.c» , а с «.cpp».
Не компилируется код
main.cpp #include #include #include «menu.h» void foo1() < std::cout.
Не компилируется код
Добрый день , помогите пожалуйста , не могу откомпилировать .Скачал Qt с офф сайта под VS 2013+.
Добавлено через 6 минут
zayats80888
Решение
Решение
clang умеет на основании расширения .cpp определить, что работа идет с c++ кодом, но цеплять стандартную библиотеку нужно самостоятельно:
clang test.cpp -lstdc++
Cororo, Братуха-убунтовод.
Убунта, как и Дебиан(«ДЕБИЛиан»), это операциоки для детей, случайно спрыгнувших с Винды)))
Нормальные инструменты разработки четко работают в Linux Fedora и CentOS. Особенно в Fedora. Там все передовое, проверенное и вылизанное. Если ты в Linux компилишь на C++, то это компилятор g++, если компилишь на чистом Си, то это gcc. Все эти понты типа «Кланг», «Гоу», «Хренанг» и прочее — это маркетинговые вбросы для детей и школьников с целью подсадить на кривые, в дальнейшем платные, инстументы. Как Оракл подсаживает на свою Джаву и как Гугл на свой никому не нужный «Гоу»)))
Добавлено через 6 минут
Ставь себе на комп по любому, хоть в виртуалку, Fedora, инсталь там компиляторы и работай как белый человек. Легко ничего не бывает. «Нажал кнопку — все заработало» — это для Юзверей. Ты же не Юзверь)))
Источник
Глюк с gcc
Нужно откомпилить один кусок кода на C++. gcc выдает странные ошибки. Дошел до того, что стал брать примеры из книжек. Вот примитивный кусок кода
#include using namespace std;
i = 10; j = 20; d = 99.101;
cout gcc ./Exampl1_1.cpp
/tmp/ccU83y8x.o(.text+0x37): In function `main’: : undefined reference to `std::cout’ /tmp/ccU83y8x.o(.text+0x3c): In function `main’: : undefined reference to `std::basic_ostream >& std::operator >(std::basic_ostream >&, char const*)’ /tmp/ccU83y8x.o(.text+0x4a): In function `main’: : undefined reference to `std::cout’ /tmp/ccU83y8x.o(.text+0x4f): In function `main’: : undefined reference to `std::basic_ostream >::operator >& std::operator >(std::basic_ostream >&, char)’ /tmp/ccU83y8x.o(.text+0x6f): In function `main’: : undefined reference to `std::cout’ /tmp/ccU83y8x.o(.text+0x74): In function `main’: : undefined reference to `std::basic_ostream >::operator >& std::operator >(std::basic_ostream >&, char)’ /tmp/ccU83y8x.o(.text+0x97): In function `main’: : undefined reference to `std::cout’ /tmp/ccU83y8x.o(.text+0x9c): In function `main’: : undefined reference to `std::basic_ostream >::operator gcc -v Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs Configured with: ../configure —enable-threads=posix —prefix=/usr —with-local-prefix=/usr/local —infodir=/usr/share/info —mandir=/usr/share/man —enable-languages=c,c++,f77,objc,java,ada —disable-checking —libdir=/usr/lib —enable-libgcj —with-gxx-include-dir=/usr/include/g++ —with-slibdir=/lib —with-system-zlib —enable-shared —enable-__cxa_atexit i586-suse-linux Thread model: posix gcc version 3.3.3 (SuSE Linux)
Странно это как-то. Посоветуйте, пожалуйста, что не так?
Источник