0

I'm trying out AppCode and CLion for developing an C++ app on macOS. CLion seems to work well, but it's not obvious how to build a Cocoa/AppKit app, or an iOS app. I downloaded a trial of AppCode, thinking it would have the same C++ engine, but it chokes on a lot of code.

A couple examples:

  1. It thinks there is no conversion from char * to std::string.
  2. It can't see the overloads in the popular fmt library.

CLion parses this stuff. Maybe I should work on getting that to build a macOS app. Is there a way to get AppCode to parse this properly and not incorrectly report errors with red underlines and popups? It compiles and runs fine. It's the editor having problems and showing "errors" in the code.

#include <string>
#include "fmt/format.h"

int main(int argc, const char * argv[]) {
    int x = 10;
    int y = 25;
    std::string name = "Godzilla";
    fmt::print("x + y = {}, name = {}", x+y, name);
    return 0;
}

Screenshot from AppCode.

The errors reported incorrectly by the editor are:

  1. Types 'std::string' and 'const char[9]' are not compatible.
  2. Parameter type mismatch: Incompatible pointer types 'FILE *' and 'const char[22]'
Rob N
  • 15,024
  • 17
  • 92
  • 165
  • Only a C++ compiler can fully understand a C++ program. C++ is just too complex. A text editor is not a C++ compiler. A text editor might employ some simplistic, heuristic logic to interpret C++ source code, but no text editor will be perfect. Just because a text editor thinks that something is not valid C++ is not something that's authoritative. Your C++ compiler will be the final judge as to whether something is or is not valid C++ code. – Sam Varshavchik Sep 02 '22 at 00:49
  • My question isn't about whether it's valid C++. It's about how to get the IDE to not clutter my screen with bogus errors. Visual Studio and CLion (same company, JetBrains) are proof that it's possible. – Rob N Sep 02 '22 at 02:58

0 Answers0