• 0

[C++] Compile error.


Question

I downloaded Borlands C++ Compiler 5.5 and when I'm about to compile a file with cpp32.exe then I get error.

My code:

  Quote
#include <stdio.h>

#include <iostream.h>

int main(void)

{

cout <<< "Hol?";

return 0;

}

The error:
  Quote
Warning W8017 c:\Program\Borland\BCC55\Include\stdlib.h 117: Redefinition of 'abs' is not identical

Why aren't the definitions identical?

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/
Share on other sites

25 answers to this question

Recommended Posts

  • 0

the problem is that your operatior is "<<<" and not the correct "<<" change that and it will fix the problem

remember these are the operators u have in c++

! ~ + - * & / %

<< >> < <= > >= == !=

^ | && || += -= *= /=

%= &= ^= |= <<= >>= , ->*

-> () [] = ++ --

new delete

there is no "<<<"

also you need a namespace

do

using namespace std;

or

useing namespace std::cout;

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1049797
Share on other sites

  • 0

did you create a project within borland? a few compilers reqiure a project to be created to store the source code in and will give errors if the source file is not contained within a project. I dont know specifically about borland though.

Your code worked in Dev-CPP on my machine with "using namespace std;" and removing one of the three "<" you had in your cout statement.

Is there a clean rebuild or rebuild all or something like that available in borland? sometimes i have noticed that if the compiler gives me an error and i fix it. then it still gives me the error because it didnt actually compile the new source file. Those options always fix it though. A wierd quirk i guess.

Edited by Iluvatar
Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1049836
Share on other sites

  • 0
  Iluvatar said:
#include <iostream> and 'using namespace std;' is really all that they would need for a simple statement like that

remember that he said with cpp32.exe, sounds like he's doing a command line compile. the paramaters need to be checked if this is the case, and that he has all the proper header files requried like iostream and such before the compile will work successfuly.

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1049859
Share on other sites

  • 0

cpp32.cfg:

-I"c:\Program\Borland\BCC55\Include"
-L"c:\Program\Borland\BCC55\lib;c:\Program\Borland\BCC55\lib\psdk"

ilink32.cfg:

-L"c:\Program\Borland\BCC55\lib;c:\Program\Borland\BCC55\lib\psdk"

Then I have Build.bat that I use when I compile:

  Quote
@c:\program\borland\bcc55\bin\cpp32 -e"test.exe" "test.c"

@pause

bcc32.exe worked just fine... but I'm trying to write some C++ now.

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1050059
Share on other sites

  • 0

bcc32 returns error too...

  Quote
Fatal F1003 c:\Program\Borland\BCC55\Include\stdcomp.h 5: Error directive: Must use C++ for STDCOMP.H

Doesn't like my file extension? Maybe it wants it to be .cpp instead of .c? :wacko:

I changed file extension and works just fine... but what does "using namespace std;" do? Where do I put it, "at the top" isn't enough for me.

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1050171
Share on other sites

  • 0

Hmm, didn't you see my code? It shows exactly where to put the using namespace std. Here it is again if you didn't see it the first time...

#include &lt;iostream&gt;
using namespace std; // &lt;-- HERE IS WHERE YOU PUT IT

int main(void)
{
   cout &lt;&lt; "Hol?";
   return 0;
}

And your extension must be .CPP for this to work, because this is C++ code. If the compiler sees .C, it'll think it's C code and you'll run into problems.

Namespaces basically avoids name conflicts. It's a C++ specific keyword. That statement tells the compiler that you're using code from the standard library (akastd>).

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1050209
Share on other sites

  • 0
  Oogle said:
Hmm, didn't you see my code? It shows exactly where to put the using namespace std. Here it is again if you didn't see it the first time...

#include &lt;iostream&gt;
using namespace std; // &lt;-- HERE IS WHERE YOU PUT IT

int main(void)
{
 ? cout &lt;&lt; "Hol?";
 ? return 0;
}

And your extension must be .CPP for this to work, because this is C++ code. If the compiler sees .C, it'll think it's C code and you'll run into problems.

Namespaces basically avoids name conflicts. It's a C++ specific keyword. That statement tells the compiler that you're using code from the standard library (astd/b>).

ah, OK.

I knew what STD ment but I had no idea what the statement did.

Thank:blush:sh:

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1050389
Share on other sites

  • 0

no,

#include "iostream.h" means its not standard while

#include <iostream.h> means it is.

" " - not

< > is

and i spent htis whole schoolyear coding console c++ apps, u dont need that namespace thing

#include &lt;iostream.h&gt;

void main()
{
   cout &lt;&lt; "Hola" &lt;&lt; endl;
}

will give hte same thing without ur special a character of course ;)

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1051097
Share on other sites

  • 0

I would like to have a fresh version of a compiler, but I ain't paying for it and I don't want some free but buggy compiler.

I don't work as a programmer and I don't sell anything that I've done so there's no reason to pay for a compiler.

All I want is a command line compiler, no fancy stuff.

I've written thousands of lines in ASM just using notepad and I'm used to that. :)

By the way, why does this code:

#include &lt;iostream.h&gt;

int main(void)
{
	std::cout &lt;&lt; "Hej hej!";
	return 0;
}

...take 112640 bytes when compiled?

I've written a program in ASM that's about 3800 lines long, graphics etc. etc. and it's a 46kB EXE?

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1051263
Share on other sites

  • 0
  Quote
and i spent htis whole schoolyear coding console c++ apps, u dont need that namespace thing
I noticed the same thing, I have never used a namespace, and everything has worked just fine.
  Quote
I don't work as a programmer and I don't sell anything that I've done so there's no reason to pay for a compiler.

Are you a student. .. . I got my from my school store for $99. That was Borland 5!

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1051983
Share on other sites

  • 0
  Chadwick 08 said:
the libraries, iostream probably calls on 3 or so more librarys which probably call on others, so in turn you can be writing a 5 line program that has 3000 lines of code from '.h' files unseen to you.

Does it include all content from all the header files? Because that doesn't make sence. :wacko:

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1052559
Share on other sites

  • 0
  Chadwick 08 said:
no,

#include "iostream.h" means its not standard while

#include <iostream.h> means it is.

" " - not

< > is

" " and < > have nothing to do with how "standard" a file is.

" " means "get the file located between the quotes". It also accepts paths relative to your project folder.

< > means "search the default include paths for this file". Paths are relative to the default include paths, which are determined by your project settings. Default means project defaults; not standard defaults.

iostream.h and iostream are 2 completely different files. Do a file search and see for yourself. Like weenur said, iostream.h is deprecated. iostream contains the implementation from the standard library.

  Quote
I noticed the same thing, I have never used a namespace, and everything has worked just fine.
All you're doing is running the risk of using a cout that's not part of the standard library. Whether or not that risk is acceptable to you fully depends on the requirements of your project. The using namespace std statement just ensures that you're using the cout from the standard library.
  Quote
I've written a program in ASM that's about 3800 lines long, graphics etc. etc. and it's a 46kB EXE?

In general, C++ gives you code maintainability and high-level abstraction at the cost of size and low-level optimization. If a smaller EXE is of the utmost importance, then you should probably stick to ASM.

  Quote
QUOTE (Chadwick 08 @ Jul 16 2003, 03:35)

the libraries, iostream probably calls on 3 or so more librarys which probably call on others, so in turn you can be writing a 5 line program that has 3000 lines of code from '.h' files unseen to you.

Does it include all content from all the header files? Because that doesn't make sence.

Header files usually take up very little space when compiled into code (unless you're inlining a lot of stuff). What takes up the bulk of the space are the libraries and object files that your program files link to. A good linker will usually leave out files that your cpp files don't call into. Also note that if you use debug libraries instead of release libraries, your executable will be much larger.

Link to comment
https://www.neowin.net/forum/topic/92199-c-compile-error/#findComment-1052979
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Do you have a 365 account? I should have been more clear, I mean free accounts.
    • What?! "May 31 2024 knowledge cutoff"?
    • Amazon Alexa+ now has more than a million users by Aditya Tiwari Amazon's muscled-up voice assistant, Alexa+, has reached a new milestone. A company spokesperson told The Verge that Alexa+ has now crossed one million users. The e-commerce giant introduced Alexa+ earlier this year as its generative AI offering. Why? It's a new trend, and everyone is doing it. According to the company, Alexa Plus offers more natural and free-flowing conversations than its predecessor. You can speak half-formed thoughts using colloquial expressions, and the AI assistant should be able to understand you and provide an answer. Announcing its capabilities, Amazon previously said that you will be able to start a conversation on your Echo device and continue it on your phone, car, or computer. One million may not be a significant number when comparing it with the number of Alexa-enabled devices out there. Amazon revealed earlier this year that there are over 600 million Alexa devices globally. However, the number of Alexa+ users has increased from 'hundreds of thousands' in the previous month. The user base is not as big as that of other names like Gemini and ChatGPT because Amazon is still offering the generative AI assistant through an Early Access program, available to Prime and non-Prime members who own a compatible Echo device. We can find social media posts from different users who have been invited to try Alexa+. While there have been positive reviews from some, the road isn't buttery smooth for others. One user claimed that the early access Alexa+ has problems accessing some temperature sensors the previous version of Alexa would. "I also really dislike how it confidently will tell me something that is incorrect now instead of just saying it doesn't know like it used to tell me," the user added. The upgraded AI voice assistant will cost $19.99 per month, but is being offered for free to Prime subscribers. Alexa+ started rolling out in the US as part of its early access program. One reason why Amazon is giving Alexa+ a slow rollout is that the new devices and services chief, Panos Panay, wants to eliminate all the problems related to the generative AI assistant. Amazon's spokesperson told the publication that the early access program doesn't include features like brainstorming gift ideas, scheduling your next spa visit, ordering groceries hands-free, and jumping to your favorite scene on Fire TV. The program also doesn't offer the "new browser-based experience at Alexa.com," which would put Amazon's AI assistant in line with ChatGPT and Gemini. These missing features will be added in the coming weeks and months, as per the spokesperson, adding that almost 90% of the features are now a part of early access.
    • MSI's 32-inch 4K QD-OLED gaming monitor gets a big price cut for UK gamers and professionals by Paul Hill If you’re a gamer in the UK and looking for a monitor to upgrade to then check out the MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor which you can now pick up for just 75% of its recommended retail price. The RRP of this monitor is £1,199, but thanks to this deal, you can get it for just £898.99 for a limited time (purchase link down below). With its 4K display, 240Hz refresh rate, and 0.03ms GTG, you’ll have the edge over other gamers by avoiding lag. At 31.5-inches, it’s the ideal monitor size if you’re sitting up close to it at a desk, you don’t want it too big at such a short range, but you also want to be able to see all the image details so 31.5-inches is a good balance. What makes QD-OLED stand out? There are loads of terms used to describe displays such as AMOLED, OLED, LED, and it can all get a bit confusing. This monitor adds yet another acronym called QD-OLED, which stands for Quantum Dot OLED. For you as a buyer, this means your new monitor has self-emitting pixels that deliver great black levels. It also features an enhanced sub-pixel arrangement for extra sharpness. The 31.5-inch 4K UHD monitor has a 3,840 x 2,160 pixel resolution making it ideal for playing games, but also watching movies in the best quality. Other important features worth mentioning are the 1.07 billion colors (10-bit) that the monitor can produce, its 99% DCI-P3 support, and DisplayHDR True Black 400 certification. All of these things make the monitor produce more accurate colours, potentially making it a good choice for professionals editing videos and photos too. Obviously, games will look good too. MSI has also packed in a fanless graphene heatsink which should help to increase the durability of the monitor long-term. This could extend the time until you need to buy a new monitor, further justifying its almost £900 price tag. Gaming and productivity features It’s not just the hardware that makes this monitor excel for gaming, it also comes with great software enhancements and connectivity options. On the software side, you get the following features: Smart Crosshair: Projects a customizable crosshair onto the screen to improve hip-fire accuracy and iron sights in first-person shooter games. Optix Scope: Gives you a built-in aim magnifier with multi-stage zooming and shortcut keys to quickly switch magnification levels. AI Vision: This automatically enhances brightness and colour saturation, particularly in dark areas of the screen, making it easier to see enemies hiding in shadows or dark corners. If you have two separate systems you want to connect to the monitor at once, you can do so with this monitor thanks to KVM support. You can view both sources with Picture-in-Picture and Picture-by-Picture modes. The MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor also supports next-gen consoles with features like HDMI CEC Profile Sync, HDMI Variable Refresh Rate (VRR), and 4K:4K downscaling. In terms of connectivity and ergonomics, you get DisplayPort 1.4a, 2x HDMI 2.1 (CEC), USB Type-C with 90W power delivery, and a USB hub. The monitor uses a tilt-, swivel- & height-adjustable stand that is VESA compatible. Should you buy this monitor? The MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor is definitely a product for serious gamers looking for top-tier visual fidelity and performance or content creators who need accurate colours and high resolution. Even with the significant discount, it’s still at a premium price and definitely not for everyone. If you are in one of the groups mentioned, then you should give serious consideration to buying the MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor as it's the lowest price the monitor has been at on Amazon to date. MSI MPG 321URX QD-OLED 31.5 Inch 4K Gaming Monitor: £898.99 (Amazon UK) / RRP £1,199 This Amazon deal is U.K. specific, and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon UK deals page here. Get Prime, Prime Video, Music Unlimited, Audible or Kindle Unlimited, free for the first 30 days As an Amazon Associate we earn from qualifying purchases.
  • Recent Achievements

    • Enthusiast
      computerdave91111 went up a rank
      Enthusiast
    • Week One Done
      Falisha Manpower earned a badge
      Week One Done
    • One Month Later
      elsa777 earned a badge
      One Month Later
    • Week One Done
      elsa777 earned a badge
      Week One Done
    • First Post
      K Dorman earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      533
    2. 2
      ATLien_0
      273
    3. 3
      +FloatingFatMan
      201
    4. 4
      +Edouard
      200
    5. 5
      snowy owl
      138
  • Tell a friend

    Love Neowin? Tell a friend!