Thread: g++ to link gcc compiled programs?

  1. #1
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446

    g++ to link gcc compiled programs?

    I'm having some trouble setting the CodeLite IDE default build engine to work with C projects. The trouble is that the default build rules for a "console gcc executable" project calls gcc -c to compile and next calls g++ for linking.

    Is this acceptable? Or is it better if I write my own makefile instead, and ignore codelite default build rules?
    Last edited by Mario F.; 09-17-2016 at 05:43 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    It's probably fine to leave it as is.

    From a console, compare the output of
    gcc -v -o a.out main.o
    g++ -v -o a.out main.o

    For me, the only obvious difference is invoking the linker via g++ will cause the linker to search some c++ libs as well, which will find nothing for C programs.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Thanks Salem. Both resulting executables are in fact identical. That settles it.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Mario F. View Post
    I'm having some trouble ... CodeLite IDE...
    I'm not surprised.

    I used it for about a year, and grew tired of the attitude of its authors. Back when C++11 was starting to become important, I suggested adding support for things like range-for (their parser erroneously saw it as an error), and they had absolutely no interest in doing the work themselves, or accepting contributed code for C++11 features. Another issue I had was that the subversion output window was moved into the subversion tree view panel, typically docked on the side of the window, and my requests to move it back to the bottom dock were met with "we like it this way, and we don't see any reason to change it," or "you can define a custom view to make it wider," despite the fact that having it in a side dock makes it so narrow as to be useless, as an output window, if you try to have enough space for code. Enough people must have complained about it, because they eventually moved it back to the bottom dock, with all the other output windows. When I used it, it was also painfully slow at parsing larger projects (my main C++ project is more than double the size now, so I can only imagine...), and somehow, it always generated the make files in a way that caused it to always do a full build, even when I'd only modify one source file. They may have improved since then, but I've moved on, and I generally recommend that others do the same. I use Qt Creator for my C++ projects now, after a short time with CLion, and have found it to be the best IDE for my purposes.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I'm starting to learn C, since there are a two projects I would wish to collaborate on. Didn't think I would be learning a new programming language at this stage. I had promised myself I wouldn't do that anymore. But alas!

    The problem I'm having however is a certain difficulty in finding a good C IDE in Linux. Most that claim C/C++ support aren't in fact, or are only partially. I mean, as Salem shown me it really isn't a problem that g++ is used to link C object files, but it certainly shows that C is only an afterthought, which ends up spilling to other parts of the IDE. But maybe that's not so bad; the GNU toolchain is best learned on the command prompt anyways.

    Frankly the idea of setting up Vim as a C IDE with all the plugins and configuration required, bores me to no end. I don't want to get that intimate with Vim and I don't want to learn how to use it beyond the essentials. I use it daily, but I don't like it. At all. I find the years-long investment it demands from people in the name of productivity, perhaps the most ridiculous sales pitch I ever heard on my life. To me it is best if it stays as a text editor and nothing more. I'll probably end up with a combination between Sublime (*) and the command prompt. But for now, CodeLite will do for learning purposes.

    (*) Which I don't like either, but such is the state of editors in this god-forsaken industry.
    Last edited by Mario F.; 09-20-2016 at 03:10 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I cannot get my programs to link...I need help!
    By arti in forum C Programming
    Replies: 2
    Last Post: 03-23-2013, 01:17 AM
  2. Can't run compiled c-programs in linux mint
    By duckdace in forum Linux Programming
    Replies: 8
    Last Post: 01-30-2011, 12:19 AM
  3. Replies: 1
    Last Post: 11-09-2009, 07:03 AM
  4. Replies: 1
    Last Post: 03-12-2008, 12:10 AM
  5. unable to link NCB programs
    By rohit in forum Windows Programming
    Replies: 0
    Last Post: 05-12-2002, 09:47 AM

Tags for this Thread