News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Cant make iomanip to work

Started by sedlacek, October 27, 2023, 03:41:06 AM

Previous topic - Next topic

sedlacek

it straight sends me to a behind page with a few log errors on "namespace std"

stahta01

The rules https://forums.next.codeblocks.org/index.php/topic,9996.0.html

namespace std;

Note: I am not a C++ Programmer; but, the problem is likely the ";" semi-colon you added or the fact you are missing an "using".

Note: As stated in the rules this is *not* a programming help web-site.

Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

sedlacek

You got me wrong, i didnt write that code. I dont know if its a IDE problem or something else, but i tried to add the iomanip library to my project and it just sent me to that page i screen shotted. I was watching one of those youtube tutotrials and the same code worked fine on another IDE. This is what i actually coded:

ios worked fine and if i type the library name wrong, it gives me an error on my acutal code page.

stahta01

#3
I suggest posting a build log in code tags if you want help; posting a image will likely get you ignored.

https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

I also suggest reading the rules. https://forums.next.codeblocks.org/index.php/topic,9996.0.html

I will not be helping you again because as I have already stated I am not a expert C++ programmer.

Edit: My best guess is you accidently typed an ";" in a header file; so, re-installing your compiler might be the proper fix.
Edit2: Yes, that is the problem. You entered an ";" and a newline in file "ctime".


namespace std
{
  using ::clock_t;
  using ::time_t;
  using ::tm;


Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

blauzahn

@sedlacek:

1. In your first screenshot gcc's error message shown by cb told you correctly where the code had a syntax error:

C:\msys64\m...  58  error: expected '{' before ';' token

One might argue that gcc's message is not as helpful as it can be. Codeblocks OTOH did its job in displaying whatever the compiler in use suggests.

2. You did not
Quoteadd the iomanip library
as it is just an include.

Please buy a decent C++-book and study it thoroughly. For C++ see https://isocpp.org/ and https://en.cppreference.com/w/. And please have a look into the links stahta01 suggested.

Thank you.