我正在尝试在我的新服务器上编译我的程序,但目前它并不适合我.
错误日志是:
rasmus@web01:~/c++$ make test
g++ `mysql_config --cflags --libs` main.cpp logger.cpp cpulogger.cpp -o test
/tmp/ccPaMZUy.o: In function `CPULogger':
/home/rasmus/c++/cpulogger.cpp:7: undefined reference to `mysql_init'
/home/rasmus/c++/cpulogger.cpp:8: undefined reference to `mysql_real_connect'
/home/rasmus/c++/cpulogger.cpp:10: undefined reference to `mysql_get_client_info'
/tmp/ccPaMZUy.o: In function `~CPULogger':
/home/rasmus/c++/cpulogger.cpp:16: undefined reference to `mysql_close'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我正在编译MySQL - 我已经检查过包含路径中是否存在mysql.h.
我错过了什么?
cpulogger.cpp在顶部有#include"cpulogger.h",然后cpulogger.h有这个:
#include <iostream>
#include <fstream>
#include <mysql/mysql.h>
Run Code Online (Sandbox Code Playgroud)
编译器不会抱怨缺少mysql/mysql.h,那么该部分必须工作吗?
rasmus@web01:~/c++$ mysql_config --cflags --libs
-I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g
-L/usr/lib -lmysqlclient -lpthread -lz -lm -lrt …Run Code Online (Sandbox Code Playgroud) 我有一个listview,我xaml填充这样的项目:
List<DataLayer.Models.Dictionary> dicts = DataLayer.Manager.getDictionaries();
if (dicts != null)
{
foreach (DataLayer.Models.Dictionary dict in dicts)
{
this.itemListView.Items.Add(dict);
}
}
Run Code Online (Sandbox Code Playgroud)
我的DataLayer.Models.Dictionary对象有一个isSelected属性以及a Name和a SubName.
名称和子名称在模板中工作正常,但如何在用户单击项目时获取项目并进行更新?
谢谢!
编辑:
我的xaml现在看起来像这样,但项目仍未选中
<ListView
x:Name="itemListView"
TabIndex="1"
Grid.Row="1"
Margin="0,60,0,0"
Padding="0,0,0,0"
IsSwipeEnabled="False"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
SelectionChanged="itemListView_SelectionChanged_1"
SelectionMode="Multiple"
FontFamily="Global User Interface">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="IsSelected" Value="{Binding Source=Selected,Mode=TwoWay}"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<Grid Margin="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Margin="0,0,0,0">
<TextBlock Text="{Binding Name}"/>
<TextBlock Text="{Binding SubName}" Style="{StaticResource CaptionTextStyle}" TextWrapping="Wrap"/>
</StackPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate> …Run Code Online (Sandbox Code Playgroud) 有没有办法为NSPopover着色?我见过像facetab这样的应用程序,有很酷的颜色和可调整的弹出窗口,这是怎么做到的?
Ay指南,提示?
谢谢.
我正在尝试复制/粘贴我的最后一个活动应用程序,这是我的代码:
NSString *appleScriptSource = [NSString stringWithFormat:@"\ntell application \"%@\" to activate\ntell application \"System Events\" to tell process \"%@\"\nkeystroke \"v\" using command down\nend tell", [lastApp localizedName], [lastApp localizedName]];
NSDictionary *error;
NSAppleScript *aScript = [[NSAppleScript alloc] initWithSource:appleScriptSource];
NSAppleEventDescriptor *aDescriptor = [aScript executeAndReturnError:&error];
Run Code Online (Sandbox Code Playgroud)
问题是在某些计算机上它工作正常,但在其他计算机上它失败了.我从executeAndReturnError返回的错误输出的错误是:
2012-06-13 17:43:19.875 Mini Translator[1206:303] (null) (error: {
NSAppleScriptErrorBriefMessage = "Expected end of line but found \U201c\"\U201d.";
NSAppleScriptErrorMessage = "Expected end of line but found \U201c\"\U201d.";
NSAppleScriptErrorNumber = "-2741";
NSAppleScriptErrorRange = "NSRange: {95, 1}";
})
Run Code Online (Sandbox Code Playgroud)
我似乎无法弄清楚它意味着什么或为什么会发生.
我们尝试将生成的Apple脚本代码复制到Apple Script编辑器中,这里工作得很好.
我的应用程序是沙箱 - 我为我想要支持的应用程序添加了密钥"com.apple.security.temporary-exception.apple-events"的软件包标识符. …
有没有人知道任何可以实现NSTextField自动完成的类或库?
我试图让标准的自动完成工作,但它是作为一个同步api.我通过互联网上的api电话获得自动完成的话.
到目前为止我做了什么:
- (void)controlTextDidChange:(NSNotification *)obj
{
if([obj object] == self.searchField)
{
[self.spinner startAnimation:nil];
[self.wordcompletionStore completeString:self.searchField.stringValue];
if(self.doingAutocomplete)
return;
else
{
self.doingAutocomplete = YES;
[[[obj userInfo] objectForKey:@"NSFieldEditor"] complete:nil];
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我的商店完成后,我有一个被调用的委托:
- (void) completionStore:(WordcompletionStore *)store didFinishWithWords:(NSArray *)arrayOfWords
{
[self.spinner stopAnimation:nil];
self.completions = arrayOfWords;
self.doingAutocomplete = NO;
}
Run Code Online (Sandbox Code Playgroud)
将完成列表返回到nstextfield的代码是:
- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index
{
*index = -1;
return self.completions;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,这将始终是1个请求,完成列表仅显示用户输入的每个第2个字符.
我试图搜索谷歌和SO像疯子一样,但我似乎无法找到任何解决方案..
任何帮助深表感谢.
是否可以让我的NSTableView接受deleteevnt(退格og甚至cmd +退格)?我有一个NSMenu,我的delete-menu-item连接到笔尖中的第一个响应者对象.
有什么指针吗?
我有一个完全简单的应用程序:使用http://tv2.dk显示Web视图
我正在使用故事板,添加了Web视图并在我的控制器上设置了属性.为了简单起见,我没有设置代表.
在viewDidLoad中,我使用我想要加载的URL调用Web视图
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://tv2.dk"]]];
Run Code Online (Sandbox Code Playgroud)
每次应用程序启动时,由于Web线程工作程序中的某些错误而导致崩溃,请参阅此转储.
libobjc.A.dylib`objc_msgSend:
0x1954f7bc0: cmp x0, #0
0x1954f7bc4: b.le 0x1954f7c30 ; objc_msgSend + 112
0x1954f7bc8: ldr x13, [x0]
0x1954f7bcc: and x9, x13, #0x1fffffff8
0x1954f7bd0: ldp x10, x11, [x9, #16]
0x1954f7bd4: and w12, w1, w11
0x1954f7bd8: add x12, x10, x12, lsl #4
0x1954f7bdc: ldp x16, x17, [x12]
0x1954f7be0: cmp x16, x1
0x1954f7be4: b.ne 0x1954f7bec ; objc_msgSend + 44
0x1954f7be8: br x17
0x1954f7bec: cbz x16, 0x1954f7d80 ; _objc_msgSend_uncached_impcache
0x1954f7bf0: cmp x12, x10
0x1954f7bf4: b.eq …Run Code Online (Sandbox Code Playgroud) 我有子类NSImageView,我想用圆角绘制边框.它工作,但我也需要剪掉图像的角落.
请看我的截图:

我创建了这个代码来绘制边框/角落.
- (void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
NSColor *strokeColor;
if(self.isSelected)
strokeColor = [NSColor colorFromHexRGB:@"f9eca2"];
else
strokeColor = [NSColor colorFromHexRGB:@"000000"];
[strokeColor set];
[[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(dirtyRect, 1, 1) xRadius:5 yRadius:5] stroke];
}
Run Code Online (Sandbox Code Playgroud)
我应该怎么做图像剪辑?
编辑:
我修好了,但我觉得这是一种丑陋的方式.还有什么更聪明的吗?
新代码:
- (void)drawRect:(NSRect)dirtyRect
{
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(dirtyRect, 2, 2) xRadius:5 yRadius:5];
[path setLineWidth:4.0];
[path addClip];
[self.image drawAtPoint: NSZeroPoint
fromRect:dirtyRect
operation:NSCompositeSourceOver
fraction: 1.0];
[super drawRect:dirtyRect];
NSColor *strokeColor;
if(self.isSelected)
{
strokeColor = [NSColor colorFromHexRGB:@"f9eca2"];
}
else
strokeColor = [NSColor colorFromHexRGB:@"000000"];
[strokeColor set];
[NSBezierPath setDefaultLineWidth:4.0];
[[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(dirtyRect, 2, …Run Code Online (Sandbox Code Playgroud) 如何从boost xml属性树中删除节点?
我有一个这样的文件:
<folders>
<folder>some/folder</folder>
<folder>some/folder</folder>
<folder>some/folder</folder>
</folders>
Run Code Online (Sandbox Code Playgroud)
我知道如何迭代和打印所有文件夹,但我如何删除其中一个项目并保存xml?
我正在努力学习和理解CoreGraphics.我想做的是做一个饼图.
饼图工作正常,看起来很棒,但我在修剪内圈时遇到了麻烦.
这是饼图中每张幻灯片的代码:
CGPoint center = CGPointMake((self.bounds.size.width/2) + self.centerOffset, (self.bounds.size.height/2) - self.centerOffset);
CGFloat radius = MIN(center.x, center.y) - 25;
radius *= self.pieScale;
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, center.x, center.y);
CGPoint p1 = CGPointMake(center.x + radius * cosf(self.startAngle), center.y + radius * sinf(self.startAngle));
CGContextAddLineToPoint(ctx, p1.x, p1.y);
int clockwise = self.startAngle > self.endAngle;
CGContextAddArc(ctx, center.x, center.y, radius, self.startAngle, self.endAngle, clockwise);
CGContextClosePath(ctx);
CGContextMoveToPoint(ctx, center.x, center.y);
CGContextAddArc(ctx, center.x, center.y, radius*0.5, self.startAngle, self.endAngle, clockwise);
CGContextSetFillColorWithColor(ctx, self.fillColor.CGColor);
CGContextSetStrokeColorWithColor(ctx, self.strokeColor.CGColor);
CGContextSetLineWidth(ctx, self.strokeWidth);
self.pathRef = CGContextCopyPath(ctx);
CGContextDrawPath(ctx, kCGPathFillStroke);
Run Code Online (Sandbox Code Playgroud)
我现在的馅饼看起来像这样:

我设法通过绘制半径较小的新路径来添加内圆.
我尝试剪切第二条路径, …
我在使用 GitHub Actions 时遇到问题。当我打电话时,productsign工作就挂起了。在搜索互联网时,该作业似乎试图要求用户输入密码,但我没有从日志中收到任何错误或反馈。这项工作永远悬而未决。当在我自己的计算机上运行时,一切都按预期运行并且 .pkg 已签名。
我的工作流程步骤如下
- name: Build & Sign Installer
run: |
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
(cd fastlane && ./decrypt_secret.sh)
carthage update --use-xcframeworks --platform macOS
bundle exec fastlane set_release_version
bundle exec fastlane mac install_certificates
bundle exec fastlane mac build_main_app
bundle exec fastlane mac build_updater
bundle exec fastlane mac build_installer
(cd installer && productsign --sign <identity> app-1.0.0.pkg app-1.0.0-signed.pkg)
Run Code Online (Sandbox Code Playgroud)
我尝试了很多不同的解决方案,但没有任何效果
security import ${P12_FILE} -k ${KEYCHAIN_PATH} -P ${P12_PASSWORD} -Asecurity import ${P12_FILE} -k ${KEYCHAIN_PATH} -P ${P12_PASSWORD} -T /usr/bin/productsign …我有一个NSTextField,用户可以在其中编写文本.我希望能够制作3个按钮:粗体,斜体和下划线; 这些按钮应将文本字段中的用户选择更改为粗体,斜体或下划线.
任何人都可以给我一个如何做到这一点的指针?
objective-c ×7
cocoa ×5
c++ ×2
ios ×2
nstextfield ×2
applescript ×1
autocomplete ×1
boost ×1
c ×1
c# ×1
code-signing ×1
copy-paste ×1
fastlane ×1
linker ×1
macos ×1
macros ×1
nsimage ×1
nsimageview ×1
nspopover ×1
nstableview ×1
productsign ×1
sandbox ×1
uiwebview ×1
windows-8 ×1
winrt-xaml ×1
xaml ×1