problem when compile with g++ and cl | Bytes (2024)

Home Posts Topics Members FAQ

marsarden

when i compile a cpp file using microsoft cl (version 13.10.3077) ,
error occurs:

singleton.h : fatal error LNK1106: invalid file or disk full: cannot
seek to 0x6D75

the command line is : cl test.cpp singleton.h -o test.exe

but ,when i using g++ on linux system , it's ok. the command line is :

g++ test.cpp singleton.h -o test

the file :

//test.cpp
#include "singleton. h"

int main(void)
{
Singleton s;
s.instance()->fun();
s.instance()->fun();
return 0;
}

//singleton.h
#include <iostream>
using namespace std;
class Singleton
{
public:
Singleton()
{
}
static Singleton* instance()
{
static Singleton* instance_;
if(!instance_)
instance_=new Singleton();
return instance_;
}
void fun(){cout<<"in stance call"<<endl;}
};

any one who help me out , what the correct cl command is ?

Oct 15 '07 #1

Subscribe Reply

3 problem when compile with g++ and cl | Bytes (1) 2214 problem when compile with g++ and cl | Bytes (2)

Michael DOUBEZ

marsarden a ¨¦crit :

when i compile a cpp file using microsoft cl (version 13.10.3077) ,
error occurs:

singleton.h : fatal error LNK1106: invalid file or disk full: cannot
seek to 0x6D75

the command line is : cl test.cpp singleton.h -o test.exe

but ,when i using g++ on linux system , it's ok. the command line is :

g++ test.cpp singleton.h -o test

I guess cl is more fashion than gcc.
Singleton hunt is open !

any one who help me out , what the correct cl command is ?

Search 'compiling a C++ program' on:
http://msdn2.microsoft.com/

This is a c++ group not an ms one.

Michael

Oct 15 '07 #2

ravinder thakur

if this wasn't obvious this is not a c++ question per se... but
anyways here is the official discussion and resoluiton for the issue
http://support.microsoft.com/kb/834332

Oct 15 '07 #3

marsarden

On 10 15 , 3 43 , ravinder thakur <ravindertha... @gmail.comwrote :

if this wasn't obvious this is not a c++ question per se... but
anyways here is the official discussion and resoluiton for the issuehttp://support.microso ft.com/kb/834332

thks alot!

Oct 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4 5367

JAXB - problem

by: jesper |last post by:

Hi I am currently following the tutorial from IBM (http://www-106.ibm.com/developerworks/xml/edu/x-dw-xjaxb-i.html) I have three problems at the moment. 1. It says else where that when the source code files are generated using the XJC, it is possible to compile the generated source code using javac generated\*.java generated\impl\*.java , but this only gives me 97 errors.?

Java

8 1978

problem about array of object

by: Sowen |last post by:

Hi, I have an object "elem", there are only simple functions inside, like setName, getName, and three constructors Now I have another class "Base", need an array of elem to initialize class Base { public:

C / C++

5 3317

compile time optimization problem

by: Carmine Cairo |last post by:

Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new rightType;

C / C++

2 9066

XmlSchema - validation trouble - .Net problem?

by: AlexS |last post by:

Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any other declaration. An error occurred at , (11, 3). Schema compile error: System.Exception: Schema error ---> System.Xml.Schema.XmlSchemaException: May no

.NET Framework

12 8477

by: SJD |last post by:

I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too. I, too, am getting nasty FileNotFound exceptions. I've read, and digested the article, and I think I've found a bug -- it's difficult to track, though it does happen often.

.NET Framework

8 613

Compile problem

by: Michael L. Hostbaek |last post by:

Hi, I am trying to compile a piece of software, on a FreeBSD system. gcc version 2.95.4 When compiling, I get lots of these warnings: --- logger.c: In function `cf_logger_init':

C / C++

9 3478

Redeclaration problem with CC

by: ludocluba |last post by:

Hello, here is my problem: I have 3 files: main.c toto.c toto.h: ----------------------------------------------------------- toto.h: #ifndef _toto_h #define _toto_h int var; void test(void); #endif -----------------------------------------------------------

C / C++

15 2416

Odd problem with Visual Studio

by: Ken Allen |last post by:

I have been developing a suite of assemblies over the past couple of weeks, and this afternoon somethign started misbehaving. If I do not run the IDE and compiler the code from the command line, the compilation seems to work properly almost all of the time. More on this later. If I launch one copy of the IDE, then I can usually compile the project at least once. At some point, the build fails reporting "Could not copy temporary files...

C# / C Sharp

1 1307

problem with accessrights when having a class in another class

by: tony |last post by:

Hello! I access the class MyComparer in this way. steel_post.Sort(new MeltPracDataComposition.Composition.MyComparer()); You can see the class definition for MyComparer below. As you can see this class MyComparer in located withing class Composition and this class Composition is located within class MeltPracDataComposition.

C# / C Sharp

1 3513

MapPoint OCX problem when VisualStudio 2008 (vs2008) is installed

by: wizmagister |last post by:

Hi everyone, I've just installed VisualStudio 2008 on my dev PC. I use this PC to compile a program that uses MapPointControl.ocx. I've compile a new version of my program using VS 2005 after installing VS2008. When I run this program in VisualStudion 2005, I can see the MapPoint Map. When I run this program on a Windows XP computer, it also works. When I run the program on Windows Vista, I get an error from the .NET framework (2.0)...

C# / C Sharp

7999

What is ONU?

by: marktang |last post by:

ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...

General

7931

Changing the language in Windows 10

by: Hystou |last post by:

Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

Windows Server

8411

Maximizing Business Potential: The Nexus of Website Design and Digital Marketing

by: jinu1996 |last post by:

In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...

Online Marketing

8281

Discussion: How does Zigbee compare with other wireless protocols in smart home applications?

by: tracyyun |last post by:

Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...

General

1 5885

Access Europe - Using VBA to create a class based on a table - Wed 1 May

by: isladogs |last post by:

The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...

Microsoft Access / VBA

5444

Couldn’t get equations in html when convert word .docx file to html file in C#.

by: conductexam |last post by:

I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...

C# / C Sharp

3956

Windows Forms - .Net 8.0

by: adsilva |last post by:

A Windows Forms form does not have the event Unload, like VB6. What one acts like?

Visual Basic .NET

1 2437

transfer the data from one system to another through ip address

by: 6302768590 |last post by:

Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

C# / C Sharp

1 1530

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisem*nts and analytics tracking please visit the page.

problem when compile with g++ and cl | Bytes (2024)

FAQs

Can you use g++ to compile C code? ›

G++ will compile not only C++ programs, but C programs as well!

How to fix compilation error in C++? ›

Compilation Errors:

This can be caused by incorrect syntax or missing components. To solve this issue, check that the syntax of the code is correct and all components are present. If the code still does not compile, check that the correct compiler is being used and that its version is up-to-date.

Should I compile with GCC or G ++? ›

When referring to C++ compilation, it is usual to call the compiler “G++”. Since there is only one compiler, it is also accurate to call it “GCC” no matter what the language context; however, the term “G++” is more useful when the emphasis is on compiling C++ programs.

What causes compile errors? ›

Compilation error or compile error refers to a state when a compiler fails to compile a piece of computer program source code, either due to errors in the code, or, more unusually, due to errors in the compiler itself. A compilation error message often helps programmers debugging the source code.

Can I compile C and C++ together? ›

If the C++ compiler provides its own versions of the C headers, the versions of those headers used by the C compiler must be compatible. Oracle Developer Studio C and C++ compilers use compatible headers, and use the same C runtime library. They are fully compatible.

What does G ++ compile mean? ›

Compiling with g++

g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file.

How do I resolve compile error? ›

  1. Avoid them! How? ...
  2. Don't write very much code! Well, not all at once anyway. ...
  3. ALWAYS ALWAYS ALWAYS fix the first compiler error first (by this I mean the one the compiler spit out first). ...
  4. If you can't figure the error out, try commenting out the code you have most recently written until it goes away. ...
  5. Take regular breaks.

What produces a compiler error? ›

Compiler errors happen when Java fails to compile the code that you've written. Recall that the code we write (all of our . java files) must be translated into a set of instructions that a computer can execute.

What are the common compilation errors in C? ›

Some common errors encountered in C programming include syntax errors, such as missing semicolons or parentheses, logical errors causing incorrect program outcomes, memory management issues like memory leaks, and run-time errors, including segmentation faults or buffer overflows.

Does G++ include GCC? ›

GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc ). However, the use of gcc does not add the C++ library. g++ is a program that calls GCC and automatically specifies linking against the C++ library.

What is the best compiler to use for C++? ›

6 best C++ compilers
  • Visual Studio Code FREE. VS (Visual Studio) Code was formerly only available for Windows, but it is now also available for Mac and Linux as well. ...
  • Eclipse FREE version. Next on our list of best C++ compilers is Eclipse. ...
  • NetBeans FREE. ...
  • Notepad++ FREE. ...
  • CodeLite FREE. ...
  • Codeblocks FREE.
Dec 2, 2022

Should I use clang or GCC for C? ›

Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.

How to fix compiler errors in C++? ›

What to do if you encounter an internal compiler error
  1. Remember that your code may not be at fault.
  2. Try a clean build.
  3. Try a command line build.
  4. Analyze the source to narrow the problem.
  5. Submit a bug report.

Which two cause a compiler error? ›

Java Programming :: Declarations and Access Control

Which two cause a compiler error? Explanation: (1) causes two compiler errors ( '[' expected and illegal start of expression) because the wrong type of bracket is used, ( ) instead of [ ]. The following is the correct syntax: float[ ] f = new float[3];

How do I get rid of compile error? ›

You can delete this cache file to see if it can fix the Compile error in the hidden module error.
  1. Press Windows + R keys at the same time. Type %appdata% in the run box.
  2. It will open your AppData folder. Go to Roaming > Microsoft > Forms.
  3. Find the . ...
  4. Restart your Excel and check if the problem is solved.
May 20, 2024

Does C++ compile C code? ›

It's pretty simple, C compiler can compile codes which contains libraries of C language. As C++ supports the libraries of C language, it will compile your C++ code only if it contains the libraries of C language. If you use any library of C++ like iostream, it will show you error.

Can I write C code in C++ compiler? ›

C++ is backward compatible with C by design, so usually C code will be compiled by C++ compiler just fine (usually because there are additional reserved words in C++ that are not in C, and could be used in C code breaking the compilation). However, I see it as bad practice mixing code.

Can I use GCC to compile C code? ›

The GNU C compiler, also known as GCC, is a simple Linux-based C compiler that's easy to use from the command line. If you're using Linux, including Ubuntu, Fedora, and Linux Mint, you can install GCC from your distribution's package manager.

Can we compile C program in Notepad ++? ›

How do I run a C language program in Notepad++? Yes, but text editor like Notepad++ is not the only thing you'll need. you will require a Compiler or an I.D.E(most of them come with compiler, interpreter and editor these days) along with it .

Top Articles
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated:

Views: 6732

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.